package com.csun.cmny.provider.utils;

import com.csun.cmny.provider.dto.DoctorWorkMedicalAdviceDownDto;
import com.csun.cmny.provider.model.domain.*;
import com.csun.cmny.provider.model.dto.disinfection.DisinfectionRecordDto;
import com.csun.cmny.provider.model.dto.disinfection.HuaLongToiletDownDto;
import com.csun.cmny.provider.model.dto.doctor.HuaLongBloodPressureDownDto;
import com.csun.cmny.provider.model.dto.doctor.HuaLongTemperatureDownDto;
import com.csun.cmny.provider.model.dto.hualong.HuaLongRosterItemDto;
import com.csun.cmny.provider.model.dto.hualong.HuaLongRosterShiftDto;
import com.csun.cmny.provider.model.dto.nuringTour.HuaLongTourDownDto;
import com.csun.cmny.provider.model.vo.BillOldmanInfoVo;
import com.csun.cmny.provider.model.vo.disinfection.HuaLongToiletDsftRecordVo;
import com.csun.cmny.provider.model.vo.disinfection.OmcDisinfectionRecordVo;
import com.csun.cmny.provider.model.vo.disinfectionPosition.HuaLongEveryDsftMethodVo;
import com.csun.cmny.provider.model.vo.disinfectionPosition.HuaLongEveryDsftPosVo;
import com.csun.cmny.provider.model.vo.disinfectionPosition.HuaLongEveryDsftRecordVo;
import com.csun.cmny.provider.model.vo.doctor.HuaLongBloodPressureRecordVo;
import com.csun.cmny.provider.model.vo.doctor.HuaLongTemperatureRecordVo;
import com.csun.cmny.provider.model.vo.hualong.HuaLongRosterVo;
import com.csun.cmny.provider.model.vo.nursingRecords.HuaLongTourRecordVo;
import com.csun.cmny.provider.model.vo.old_out.OldOutDaysFeeVo;
import com.csun.cmny.provider.model.vo.old_out.OldOutItemVo;
import com.csun.cmny.provider.model.vo.old_out.OldOutVo;
import com.csun.cmny.provider.model.vo.revise.ReviseItemVo;
import com.csun.cmny.provider.model.vo.revise.ReviseVo;
import com.csun.cmny.provider.model.vo.sanitation.HuaLongSanitationItemVo;
import com.csun.cmny.provider.model.vo.sanitation.HuaLongSanitationVo;
import com.csun.cmny.provider.resolver.CmnyMessageSource;
import com.csun.cmny.provider.vo.DoctorWorkMedicalAdviceDownVo;
import com.csun.cmny.provider.vo.OmcOldManBillDetailVo;
import com.csun.cmny.util.PublicUtil;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import io.swagger.models.auth.In;
import jxl.SheetSettings;
import jxl.Workbook;
import jxl.format.Alignment;
import jxl.format.Colour;
import jxl.format.UnderlineStyle;
import jxl.format.VerticalAlignment;
import jxl.write.*;
import jxl.write.biff.RowsExceededException;
import org.apache.commons.lang3.StringUtils;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import java.util.List;
import java.util.Map;

/** 
 * jxl导出excel 
 * @author jamboree 
 * @date  2013-11-28 
 */  
public class JxlExcelUtils {

	@Resource
	private CmnyMessageSource cmnyMessageSource;
  
	/**
	 * 导出医院
	 * @param response
	 * @param objData
	 * @param sheetName
	 * @param columns
	 */
	public static void hospitalToExcel(HttpServletResponse response , List<Map<String,Object>> objData,
                                       String sheetName, List<String> columns ){
		
		OutputStream os = null;
		WritableWorkbook workbook = null;
		
		try{
			os = response.getOutputStream();
			workbook=Workbook.createWorkbook(os);
			WritableSheet sheet = workbook.createSheet(sheetName, 0 ); //添加第一个工作表
			
			WritableFont wft = new  WritableFont(WritableFont.ARIAL, 10 ,WritableFont.BOLD, false ,UnderlineStyle.NO_UNDERLINE,Colour.BLACK);
			WritableCellFormat wcfFT = new WritableCellFormat(wft);
			wcfFT.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
			//wcfFT.setWrap(true);
			WritableFont wfcc = new  WritableFont(WritableFont.ARIAL, 10 ,WritableFont.NO_BOLD, false ,UnderlineStyle.NO_UNDERLINE,Colour.BLACK);
			WritableCellFormat wfcf = new  WritableCellFormat(wfcc);
			wfcf.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
			wfcf.setWrap(true);

			//合并单元格
			//sheet.mergeCells(int col1,int row1,int col2,int row2);//左上角到右下角
			sheet.mergeCells(0, 0, 7, 1); //左上角到右下角
			WritableFont wfc = new  WritableFont(WritableFont.ARIAL, 20 ,WritableFont.BOLD, false ,UnderlineStyle.NO_UNDERLINE,Colour.BLACK);
			WritableCellFormat wchB = new  WritableCellFormat(wfc);
			wchB.setAlignment(Alignment.CENTRE);
			wchB.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);

			Label labelCFC = new  Label( 0 , 0 , "医院信息统计" ,wchB);
			sheet.addCell(labelCFC);

			sheet.setColumnView(1, 30);
			sheet.setColumnView(2, 12);
			sheet.setColumnView(3, 10);
			sheet.setColumnView(4, 10);
			sheet.setColumnView(5, 10);
			sheet.setColumnView(6, 12);
			sheet.setColumnView(7, 25);

			//循环写入表头
            for (int i = 0; i < columns.size(); i++) {

            	sheet.addCell(new Label(i, 2, columns.get(i), wcfFT));
            }

            if( objData != null &&  objData.size() > 0){
            	//循环写出数据

            	for(int i = 0; i<objData.size(); i++){

            		//获取医院信息
            		Map<String,Object> hospital = (Map<String,Object>)objData.get(i);

            		//在Excel列里面写出医院的信息

            		sheet.addCell(new Label(0,i+3,String.valueOf(i+1),wfcf));//序号
            		sheet.addCell(new Label(1,i+3,String.valueOf(hospital.get("hospitalname")),wfcf)); //医院名称
            		String hosType =String.valueOf(hospital.get("type")).trim();   //获取医院的类型
            		if(StringUtils.isBlank(hosType)){
            			hosType = "/";
            		}else{
            			if("1".equals(hosType)){
                			hosType = "初筛";
                		}else if("2".equals(hosType)){
                			hosType = "复筛";
                		}else if("3".endsWith(hosType)){
                			hosType = "初、复筛";
                		}else{
                			hosType = "/";
                		}
            		}
            		sheet.addCell(new Label(2,i+3,hosType,wfcf));           //医院类型

            		sheet.addCell(new Label(3,i+3,String.valueOf(hospital.get("provincename")),wfcf));           //省份
            		sheet.addCell(new Label(4,i+3,String.valueOf(hospital.get("cityname")),wfcf));           //市名
            		sheet.addCell(new Label(5,i+3,String.valueOf(hospital.get("areaName")),wfcf));           //区域
            		String salesman = String.valueOf(hospital.get("realname"));    //客服专员
            		//System.out.println("业务员"+ salesman);
            		if(StringUtils.isBlank(salesman)||salesman.equals("null")){
            			salesman = "/";
            		}
            		sheet.addCell(new Label(6,i+3,salesman,wfcf));           //客服专员
            		sheet.addCell(new Label(7,i+3,String.valueOf(hospital.get("createTime")),wfcf));           //创建时间

            	}

            	//写入Excel工作表
                workbook.write();

            }

            //关闭Excel工作薄对象
            workbook.close();

            //关闭流
            os.flush();
            os.close();

            os =null;

		}catch(Exception e){
			e.printStackTrace();
		}


	}

	public static void patientToExcel(HttpServletResponse response, List<Map<String, Object>> objData, String sheetName, List<String> columns,
                                      boolean isShow, boolean isManager) {

		WritableWorkbook workbook;
		try {
			OutputStream os = response.getOutputStream();
			workbook=Workbook.createWorkbook(os);

			WritableSheet sheet = workbook.createSheet(sheetName, 0 );  //添加第一个工作表

			WritableFont wft = new  WritableFont(WritableFont.ARIAL, 10 ,WritableFont.BOLD, false ,UnderlineStyle.NO_UNDERLINE,Colour.BLACK);
			WritableCellFormat wcfFT = new WritableCellFormat(wft);
			wcfFT.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
			//wcfFT.setWrap(true);
			WritableFont wfcc = new  WritableFont(WritableFont.ARIAL, 10 ,WritableFont.NO_BOLD, false ,UnderlineStyle.NO_UNDERLINE,Colour.BLACK);
			WritableCellFormat wfcf = new  WritableCellFormat(wfcc);
			wfcf.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
			wfcf.setWrap(true);

			//合并单元格
			//sheet.mergeCells(int col1,int row1,int col2,int row2);//左上角到右下角
			sheet.mergeCells(0, 0, 19, 1); //左上角到右下角
			WritableFont wfc = new  WritableFont(WritableFont.ARIAL, 20 ,WritableFont.BOLD, false ,UnderlineStyle.NO_UNDERLINE,Colour.BLACK);
			WritableCellFormat wchB = new  WritableCellFormat(wfc);
			wchB.setAlignment(Alignment.CENTRE);
			wchB.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);

			Label labelCFC = new  Label( 0 , 0 , "患者信息统计" ,wchB);
			sheet.addCell(labelCFC); //
			sheet.setColumnView(2, 12);
			sheet.setColumnView(3, 12);
			sheet.setColumnView(6, 12);
			sheet.setColumnView(8, 25);
			sheet.setColumnView(9, 12);
			sheet.setColumnView(10, 12);
			if (isManager) {
				sheet.setColumnView(10, 0);
			}
			sheet.setColumnView(11, 20);
			sheet.setColumnView(12, 12);
			sheet.setColumnView(14, 15);
			sheet.setColumnView(15, 15);
			sheet.setColumnView(16, 12);
			sheet.setColumnView(17, 12);
			sheet.setColumnView(18, 12);
			sheet.setColumnView(19, 12);
//			jxl.write.Label label;
//			for  ( int  i= 0 ; i<title.length; i++)
//			{
//				//Label(列号,行号 ,内容 )
//				label = new  jxl.write.Label(i,  2, title[i], wcfFT);  //put the title in row1
//				sheet.addCell(label);
//			}

			//循环写入表头
            for (int i = 0; i < columns.size(); i++) {

                /*
                 * 添加单元格(Cell)内容addCell()
                 * 添加Label对象Label()
                 * 数据的类型有很多种、在这里你需要什么类型就导入什么类型
                 * 如：jxl.write.DateTime 、jxl.write.Number、jxl.write.Label
                 * Label(i, 0, columns[i], wcf)
                 * 其中i为列、0为行、columns[i]为数据、wcf为样式
                 * 合起来就是说将columns[i]添加到第一行(行、列下标都是从0开始)第i列、样式为什么"色"内容居中
                 */
            	sheet.addCell(new Label(i, 2, columns.get(i), wcfFT));
            }

			//判断表中是否有数据
            if (objData != null && objData.size() > 0) {
                //循环写入表中数据
                for (int i = 0; i < objData.size(); i++) {

                    //转换成map集合{activyName:测试功能,count:2}
                    Map<String, Object> map = (Map<String, Object>)objData.get(i);

                    //循环输出map中的子集：既列值
                    sheet.addCell(new Label(0, i + 3, String.valueOf(i+1), wfcf));
                    String patientName = String.valueOf(map.get("patientName"));
                    if (patientName == null || patientName.equals("null") || patientName.equals("")) {
                    	patientName = "/";
                    }
                    sheet.addCell(new Label(1, i + 3, patientName, wfcf));
                    sheet.addCell(new Label(2, i + 3, String.valueOf(map.get("birthday")), wfcf));
//                    sheet.addCell(new Label(3, i + 3, String.valueOf(map.get("ageMonth")), wfcf));
                    sheet.addCell(new Label(3, i + 3, String.valueOf(map.get("firstAge")), wfcf));
                    if (String.valueOf(map.get("sex")).equals("0")) {
                    	//System.out.println("男");
                    	sheet.addCell(new Label(4, i + 3, "男", wfcf));
                    } else {
                    	//System.out.println("女");
                    	sheet.addCell(new Label(4, i + 3, "女", wfcf));
                    }
                    //sheet.addCell(new Label(3, i + 3, String.valueOf(map.get("sex")), wfcf));
                    sheet.addCell(new Label(5, i + 3, String.valueOf(map.get("areaName")), wfcf));
                    sheet.addCell(new Label(6, i + 3, String.valueOf(map.get("entity")), wfcf));
                    sheet.addCell(new Label(7, i + 3, String.valueOf(map.get("part")), wfcf));
                    sheet.addCell(new Label(8, i + 3, String.valueOf(map.get("first_desc")), wfcf));
                    sheet.addCell(new Label(9, i + 3, String.valueOf(map.get("hospital")), wfcf));
                    String fchospital = String.valueOf(map.get("fchospital"));
                    if (fchospital == null || fchospital.equals("null") || fchospital.equals("")) {
                    	fchospital = "/";
                    }
                    if (isManager) {
                    	sheet.addCell(new Label(10, i + 3, "*****", wfcf));
                    } else {
                    	sheet.addCell(new Label(10, i + 3, fchospital, wfcf));
                    }
                    sheet.addCell(new Label(11, i + 3, String.valueOf(map.get("createTime")), wfcf));
                    String phone2 = String.valueOf(map.get("phone"));
                    if (isShow) {
                    	sheet.addCell(new Label(12, i + 3, String.valueOf(map.get("fatherPhone")), wfcf));
                    } else {
                    	if (phone2.length() > 7) {
                    		sheet.addCell(new Label(12, i + 3, phone2.substring(0,4) + "***" + phone2.substring(7, phone2.length()), wfcf));
        				} else {
        					sheet.addCell(new Label(12, i + 3, String.valueOf(map.get("phone")), wfcf));
        				}
                    }
                    if (String.valueOf(map.get("pic")).equals("0")) {
                    	sheet.addCell(new Label(13, i + 3, "/", wfcf));
                    } else {
                    	sheet.addCell(new Label(13, i + 3, "有", wfcf));
                    }
                    sheet.addCell(new Label(14, i + 3, String.valueOf(map.get("doctorName")), wfcf));
                    String phone3 = String.valueOf(map.get("mobilePhone"));
                    if (isShow) {
                    	sheet.addCell(new Label(15, i + 3, String.valueOf(map.get("mobilePhone")), wfcf));
                    } else {
                    	if (phone3.length() > 7) {
                    		sheet.addCell(new Label(15, i + 3, phone3.substring(0,4) + "***" + phone3.substring(7, phone3.length()), wfcf));
        				} else {
        					sheet.addCell(new Label(15, i + 3, String.valueOf(map.get("mobilePhone")), wfcf));
        				}
                    }
                    String entity_type = String.valueOf(map.get("entity_type"));
                    if (entity_type == null || entity_type.equals("null") || entity_type.equals("")) {
                    	entity_type = "/";
                    }
                    sheet.addCell(new Label(16, i + 3, entity_type, wfcf));
                    String isfcheck = String.valueOf(map.get("isfcheck"));
                    if (isfcheck == null || isfcheck.equals("null") || isfcheck.equals("")) {
                    	isfcheck = "/";
                    }
                    sheet.addCell(new Label(17, i + 3, isfcheck, wfcf));
                    String cure_type = String.valueOf(map.get("cure_type"));
                    if (cure_type == null || cure_type.equals("null") || cure_type.equals("")) {
                    	cure_type = "/";
                    }
                    sheet.addCell(new Label(18, i + 3, cure_type, wfcf));
                    sheet.addCell(new Label(19, i + 3, String.valueOf(map.get("loginCount")), wfcf));
//                    for(Object o:map.keySet()){
//                        //ps：因为要“”通用”“导出功能，所以这里循环的时候不是get("Name"),而是通过map.get(o)
//                    	sheet.addCell(new Label(j,i+3,String.valueOf(map.get(o)), wfcf));
//                        j++;
//                    }
                }

              //写入Excel工作表
                workbook.write();

                //关闭Excel工作薄对象
                workbook.close();

                //关闭流
                os.flush();
                os.close();

                os =null;
            }else{
            	System.out.println("没有数据.");
            	//写入Excel工作表
                workbook.write();

                //关闭Excel工作薄对象
                workbook.close();

                //关闭流
                os.flush();
                os.close();

                os =null;
                //flag = -1;
            }

		} catch (Exception e) {
			e.printStackTrace();
		}

	}

	public static void mpatientToExcel(HttpServletResponse response, List<Map<String, Object>> objData, String sheetName, List<String> columns,
                                       boolean isShow, boolean isManager) {

		WritableWorkbook workbook;
		try {
			OutputStream os = response.getOutputStream();
			workbook=Workbook.createWorkbook(os);

			WritableSheet sheet = workbook.createSheet(sheetName, 0 );  //添加第一个工作表

			WritableFont wft = new  WritableFont(WritableFont.ARIAL, 10 ,WritableFont.BOLD, false ,UnderlineStyle.NO_UNDERLINE,Colour.BLACK);
			WritableCellFormat wcfFT = new WritableCellFormat(wft);
			wcfFT.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
			//wcfFT.setWrap(true);
			WritableFont wfcc = new  WritableFont(WritableFont.ARIAL, 10 ,WritableFont.NO_BOLD, false ,UnderlineStyle.NO_UNDERLINE,Colour.BLACK);
			WritableCellFormat wfcf = new  WritableCellFormat(wfcc);
			wfcf.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
			wfcf.setWrap(true);

			//合并单元格
			//sheet.mergeCells(int col1,int row1,int col2,int row2);//左上角到右下角
			sheet.mergeCells(0, 0, 17, 1); //左上角到右下角
			WritableFont wfc = new  WritableFont(WritableFont.ARIAL, 20 ,WritableFont.BOLD, false ,UnderlineStyle.NO_UNDERLINE,Colour.BLACK);
			WritableCellFormat wchB = new  WritableCellFormat(wfc);
			wchB.setAlignment(Alignment.CENTRE);
			wchB.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);

			Label labelCFC = new  Label( 0 , 0 , "患者信息统计" ,wchB);
			sheet.addCell(labelCFC); //
			sheet.setColumnView(2, 12);
			sheet.setColumnView(3, 12);
			sheet.setColumnView(6, 12);
			sheet.setColumnView(8, 25);
			sheet.setColumnView(9, 15);
			/*
			sheet.setColumnView(9, 12);
			if (isManager) {
				sheet.setColumnView(9, 0);
			}
			*/
			sheet.setColumnView(10, 20);
			sheet.setColumnView(11, 12);
			sheet.setColumnView(13, 15);
			sheet.setColumnView(14, 15);
			sheet.setColumnView(15, 15);
			sheet.setColumnView(16, 15);
			sheet.setColumnView(17, 15);
//			jxl.write.Label label;
//			for  ( int  i= 0 ; i<title.length; i++)
//			{
//				//Label(列号,行号 ,内容 )
//				label = new  jxl.write.Label(i,  2, title[i], wcfFT);  //put the title in row1
//				sheet.addCell(label);
//			}

			//循环写入表头
            for (int i = 0; i < columns.size(); i++) {

                /*
                 * 添加单元格(Cell)内容addCell()
                 * 添加Label对象Label()
                 * 数据的类型有很多种、在这里你需要什么类型就导入什么类型
                 * 如：jxl.write.DateTime 、jxl.write.Number、jxl.write.Label
                 * Label(i, 0, columns[i], wcf)
                 * 其中i为列、0为行、columns[i]为数据、wcf为样式
                 * 合起来就是说将columns[i]添加到第一行(行、列下标都是从0开始)第i列、样式为什么"色"内容居中
                 */
            	sheet.addCell(new Label(i, 2, columns.get(i), wcfFT));
            }

			//判断表中是否有数据
            if (objData != null && objData.size() > 0) {
                //循环写入表中数据
                for (int i = 0; i < objData.size(); i++) {

                    //转换成map集合{activyName:测试功能,count:2}
                    Map<String, Object> map = (Map<String, Object>)objData.get(i);

                    //循环输出map中的子集：既列值
                    sheet.addCell(new Label(0, i + 3, String.valueOf(i+1), wfcf));
                    String patientName = String.valueOf(map.get("patientName"));
                    if (patientName == null || patientName.equals("null") || patientName.equals("")) {
                    	patientName = "/";
                    }
                    sheet.addCell(new Label(1, i + 3, patientName, wfcf));
                    sheet.addCell(new Label(2, i + 3, String.valueOf(map.get("birthday")), wfcf));
                    //sheet.addCell(new Label(3, i + 3, String.valueOf(map.get("ageMonth")), wfcf));
                    sheet.addCell(new Label(3, i + 3, String.valueOf(map.get("firstAge")), wfcf));
                    if (String.valueOf(map.get("sex")).equals("0")) {
                    	//System.out.println("男");
                    	sheet.addCell(new Label(4, i + 3, "男", wfcf));
                    } else {
                    	//System.out.println("女");
                    	sheet.addCell(new Label(4, i + 3, "女", wfcf));
                    }
                    //sheet.addCell(new Label(3, i + 3, String.valueOf(map.get("sex")), wfcf));
                    sheet.addCell(new Label(5, i + 3, String.valueOf(map.get("areaName")), wfcf));
                    sheet.addCell(new Label(6, i + 3, String.valueOf(map.get("entity")), wfcf));
                    sheet.addCell(new Label(7, i + 3, String.valueOf(map.get("part")), wfcf));
                    sheet.addCell(new Label(8, i + 3, String.valueOf(map.get("first_desc")), wfcf));
                    sheet.addCell(new Label(9, i + 3, String.valueOf(map.get("hospital")), wfcf));
                    String fchospital = String.valueOf(map.get("fchospital"));
                    if (fchospital == null || fchospital.equals("null") || fchospital.equals("")) {
                    	fchospital = "/";
                    }
                    /*
                    if (isManager) {
                    	sheet.addCell(new Label(9, i + 3, "*****", wfcf));
                    } else {
                    	sheet.addCell(new Label(9, i + 3, fchospital, wfcf));
                    }
                    */
                    sheet.addCell(new Label(10, i + 3, String.valueOf(map.get("createTime")), wfcf));
                    String phone2 = String.valueOf(map.get("phone"));
                    if (isShow) {
                    	sheet.addCell(new Label(11, i + 3, String.valueOf(map.get("fatherPhone")), wfcf));
                    } else {
                    	if (phone2.length() > 7) {
                    		sheet.addCell(new Label(11, i + 3, phone2.substring(0,4) + "***" + phone2.substring(7, phone2.length()), wfcf));
        				} else {
        					sheet.addCell(new Label(11, i + 3, String.valueOf(map.get("phone")), wfcf));
        				}
                    }
                    if (String.valueOf(map.get("pic")).equals("0")) {
                    	sheet.addCell(new Label(12, i + 3, "/", wfcf));
                    } else {
                    	sheet.addCell(new Label(12, i + 3, "有", wfcf));
                    }
//                    for(Object o:map.keySet()){
//                        //ps：因为要“”通用”“导出功能，所以这里循环的时候不是get("Name"),而是通过map.get(o)
//                    	sheet.addCell(new Label(j,i+3,String.valueOf(map.get(o)), wfcf));
//                        j++;
//                    }
                    sheet.addCell(new Label(13, i + 3, String.valueOf(map.get("doctorName")), wfcf));
                    String entity_type = String.valueOf(map.get("entity_type"));
                    if (entity_type == null || entity_type.equals("null") || entity_type.equals("")) {
                    	entity_type = "/";
                    }
                    sheet.addCell(new Label(14, i + 3, entity_type, wfcf));
                    String isfcheck = String.valueOf(map.get("isfcheck"));
                    if (isfcheck == null || isfcheck.equals("null") || isfcheck.equals("")) {
                    	isfcheck = "/";
                    }
                    sheet.addCell(new Label(15, i + 3, isfcheck, wfcf));
                    String cure_type = String.valueOf(map.get("cure_type"));
                    if (cure_type == null || cure_type.equals("null") || cure_type.equals("")) {
                    	cure_type = "/";
                    }
                    sheet.addCell(new Label(16, i + 3, cure_type, wfcf));
                    sheet.addCell(new Label(17, i + 3, String.valueOf(map.get("loginCount")), wfcf));
                    //System.out.println("111111111111111111111111111");
                    /*
                    String phone3 = String.valueOf(map.get("mobilePhone"));
                    if (isShow) {
                    	sheet.addCell(new Label(13, i + 3, String.valueOf(map.get("mobilePhone")), wfcf));
                    } else {
                    	if (phone3.length() > 7) {
                    		sheet.addCell(new Label(13, i + 3, phone3.substring(0,4) + "***" + phone3.substring(7, phone3.length()), wfcf));
        				} else {
        					sheet.addCell(new Label(13, i + 3, String.valueOf(map.get("mobilePhone")), wfcf));
        				}
                    }
                    String entity_type = String.valueOf(map.get("entity_type"));
                    if (entity_type == null || entity_type.equals("null") || entity_type.equals("")) {
                    	entity_type = "/";
                    }
                    sheet.addCell(new Label(14, i + 3, entity_type, wfcf));
                    String cure_type = String.valueOf(map.get("cure_type"));
                    if (cure_type == null || cure_type.equals("null") || cure_type.equals("")) {
                    	cure_type = "/";
                    }
                    sheet.addCell(new Label(15, i + 3, cure_type, wfcf));
                    */
                }

              //写入Excel工作表
                workbook.write();

                //关闭Excel工作薄对象
                workbook.close();

                //关闭流
                os.flush();
                os.close();

                os =null;
            }else{
            	System.out.println("没有数据.");
            	//写入Excel工作表
                workbook.write();

                //关闭Excel工作薄对象
                workbook.close();

                //关闭流
                os.flush();
                os.close();

                os =null;
                //flag = -1;
            }

		} catch (Exception e) {
			e.printStackTrace();
		}

	}

	public static void spatientToExcel(HttpServletResponse response, List<Map<String, Object>> objData, String sheetName, List<String> columns,
                                       boolean isShow, boolean isManager) {

		WritableWorkbook workbook;
		try {
			OutputStream os = response.getOutputStream();
			workbook=Workbook.createWorkbook(os);

			WritableSheet sheet = workbook.createSheet(sheetName, 0 );  //添加第一个工作表

			WritableFont wft = new  WritableFont(WritableFont.ARIAL, 10 ,WritableFont.BOLD, false ,UnderlineStyle.NO_UNDERLINE,Colour.BLACK);
			WritableCellFormat wcfFT = new WritableCellFormat(wft);
			wcfFT.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
			//wcfFT.setWrap(true);
			WritableFont wfcc = new  WritableFont(WritableFont.ARIAL, 10 ,WritableFont.NO_BOLD, false ,UnderlineStyle.NO_UNDERLINE,Colour.BLACK);
			WritableCellFormat wfcf = new  WritableCellFormat(wfcc);
			wfcf.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
			wfcf.setWrap(true);

			//合并单元格
			//sheet.mergeCells(int col1,int row1,int col2,int row2);//左上角到右下角
			sheet.mergeCells(0, 0, 18, 1); //左上角到右下角
			WritableFont wfc = new  WritableFont(WritableFont.ARIAL, 20 ,WritableFont.BOLD, false ,UnderlineStyle.NO_UNDERLINE,Colour.BLACK);
			WritableCellFormat wchB = new  WritableCellFormat(wfc);
			wchB.setAlignment(Alignment.CENTRE);
			wchB.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);

			Label labelCFC = new  Label( 0 , 0 , "患者信息统计" ,wchB);
			sheet.addCell(labelCFC); //
			sheet.setColumnView(2, 12);
			sheet.setColumnView(3, 12);
			sheet.setColumnView(6, 12);
			sheet.setColumnView(8, 25);
			sheet.setColumnView(9, 12);
			sheet.setColumnView(10, 12);
			if (isManager) {
				sheet.setColumnView(10, 0);
			}
			sheet.setColumnView(11, 20);
			sheet.setColumnView(12, 12);
			sheet.setColumnView(14, 15);
			sheet.setColumnView(15, 15);
			sheet.setColumnView(16, 15);
			sheet.setColumnView(17, 15);
			sheet.setColumnView(18, 15);
//			jxl.write.Label label;
//			for  ( int  i= 0 ; i<title.length; i++)
//			{
//				//Label(列号,行号 ,内容 )
//				label = new  jxl.write.Label(i,  2, title[i], wcfFT);  //put the title in row1
//				sheet.addCell(label);
//			}

			//循环写入表头
            for (int i = 0; i < columns.size(); i++) {

                /*
                 * 添加单元格(Cell)内容addCell()
                 * 添加Label对象Label()
                 * 数据的类型有很多种、在这里你需要什么类型就导入什么类型
                 * 如：jxl.write.DateTime 、jxl.write.Number、jxl.write.Label
                 * Label(i, 0, columns[i], wcf)
                 * 其中i为列、0为行、columns[i]为数据、wcf为样式
                 * 合起来就是说将columns[i]添加到第一行(行、列下标都是从0开始)第i列、样式为什么"色"内容居中
                 */
            	sheet.addCell(new Label(i, 2, columns.get(i), wcfFT));
            }

			//判断表中是否有数据
            if (objData != null && objData.size() > 0) {
                //循环写入表中数据
                for (int i = 0; i < objData.size(); i++) {

                    //转换成map集合{activyName:测试功能,count:2}
                    Map<String, Object> map = (Map<String, Object>)objData.get(i);

                    //循环输出map中的子集：既列值
                    sheet.addCell(new Label(0, i + 3, String.valueOf(i+1), wfcf));
                    String patientName = String.valueOf(map.get("patientName"));
                    if (patientName == null || patientName.equals("null") || patientName.equals("")) {
                    	patientName = "/";
                    }
                    sheet.addCell(new Label(1, i + 3, patientName, wfcf));
                    sheet.addCell(new Label(2, i + 3, String.valueOf(map.get("birthday")), wfcf));
//                    sheet.addCell(new Label(3, i + 3, String.valueOf(map.get("ageMonth")), wfcf));
                    sheet.addCell(new Label(3, i + 3, String.valueOf(map.get("firstAge")), wfcf));
                    if (String.valueOf(map.get("sex")).equals("0")) {
                    	//System.out.println("男");
                    	sheet.addCell(new Label(4, i + 3, "男", wfcf));
                    } else {
                    	//System.out.println("女");
                    	sheet.addCell(new Label(4, i + 3, "女", wfcf));
                    }
                    //sheet.addCell(new Label(3, i + 3, String.valueOf(map.get("sex")), wfcf));
                    sheet.addCell(new Label(5, i + 3, String.valueOf(map.get("areaName")), wfcf));
                    sheet.addCell(new Label(6, i + 3, String.valueOf(map.get("entity")), wfcf));
                    sheet.addCell(new Label(7, i + 3, String.valueOf(map.get("part")), wfcf));
                    sheet.addCell(new Label(8, i + 3, String.valueOf(map.get("first_desc")), wfcf));
                    sheet.addCell(new Label(9, i + 3, String.valueOf(map.get("hospital")), wfcf));
                    String fchospital = String.valueOf(map.get("fchospital"));
                    if (fchospital == null || fchospital.equals("null") || fchospital.equals("")) {
                    	fchospital = "/";
                    }
                    if (isManager) {
                    	sheet.addCell(new Label(10, i + 3, "*****", wfcf));
                    } else {
                    	sheet.addCell(new Label(10, i + 3, fchospital, wfcf));
                    }
                    sheet.addCell(new Label(11, i + 3, String.valueOf(map.get("createTime")), wfcf));
                    String phone2 = String.valueOf(map.get("phone"));
                    if (isShow) {
                    	sheet.addCell(new Label(12, i + 3, String.valueOf(map.get("fatherPhone")), wfcf));
                    } else {
                    	if (phone2.length() > 7) {
                    		sheet.addCell(new Label(12, i + 3, phone2.substring(0,4) + "***" + phone2.substring(7, phone2.length()), wfcf));
        				} else {
        					sheet.addCell(new Label(12, i + 3, String.valueOf(map.get("phone")), wfcf));
        				}
                    }
                    if (String.valueOf(map.get("pic")).equals("0")) {
                    	sheet.addCell(new Label(13, i + 3, "/", wfcf));
                    } else {
                    	sheet.addCell(new Label(13, i + 3, "有", wfcf));
                    }
                    sheet.addCell(new Label(14, i + 3, String.valueOf(map.get("doctorName")), wfcf));

                    String entity_type = String.valueOf(map.get("entity_type"));
                    if (entity_type == null || entity_type.equals("null") || entity_type.equals("")) {
                    	entity_type = "/";
                    }
                    sheet.addCell(new Label(15, i + 3, entity_type, wfcf));
                    String isfcheck = String.valueOf(map.get("isfcheck"));
                    if (isfcheck == null || isfcheck.equals("null") || isfcheck.equals("")) {
                    	isfcheck = "/";
                    }
                    sheet.addCell(new Label(16, i + 3, isfcheck, wfcf));
                    String cure_type = String.valueOf(map.get("cure_type"));
                    if (cure_type == null || cure_type.equals("null") || cure_type.equals("")) {
                    	cure_type = "/";
                    }
                    sheet.addCell(new Label(17, i + 3, cure_type, wfcf));
                    sheet.addCell(new Label(18, i + 3, String.valueOf(map.get("loginCount")), wfcf));
                    /*
                    String phone3 = String.valueOf(map.get("mobilePhone"));
                    if (isShow) {
                    	sheet.addCell(new Label(14, i + 3, String.valueOf(map.get("mobilePhone")), wfcf));
                    } else {
                    	if (phone3.length() > 7) {
                    		sheet.addCell(new Label(14, i + 3, phone3.substring(0,4) + "***" + phone3.substring(7, phone3.length()), wfcf));
        				} else {
        					sheet.addCell(new Label(14, i + 3, String.valueOf(map.get("mobilePhone")), wfcf));
        				}
                    }
                    String entity_type = String.valueOf(map.get("entity_type"));
                    if (entity_type == null || entity_type.equals("null") || entity_type.equals("")) {
                    	entity_type = "/";
                    }
                    sheet.addCell(new Label(15, i + 3, entity_type, wfcf));
                    String cure_type = String.valueOf(map.get("cure_type"));
                    if (cure_type == null || cure_type.equals("null") || cure_type.equals("")) {
                    	cure_type = "/";
                    }
                    sheet.addCell(new Label(16, i + 3, cure_type, wfcf));
                    */
//                    for(Object o:map.keySet()){
//                        //ps：因为要“”通用”“导出功能，所以这里循环的时候不是get("Name"),而是通过map.get(o)
//                    	sheet.addCell(new Label(j,i+3,String.valueOf(map.get(o)), wfcf));
//                        j++;
//                    }
                }

              //写入Excel工作表
                workbook.write();

                //关闭Excel工作薄对象
                workbook.close();

                //关闭流
                os.flush();
                os.close();

                os =null;
            }else{
            	System.out.println("没有数据.");
            	//写入Excel工作表
                workbook.write();

                //关闭Excel工作薄对象
                workbook.close();

                //关闭流
                os.flush();
                os.close();

                os =null;
                //flag = -1;
            }

		} catch (Exception e) {
			e.printStackTrace();
		}

	}

    public static void exportPatientToExcel(String path, List<Map<String, Object>> objData) {
		String targetfile = path ; //输出的excel文件名
		String worksheet = "患者信息" ; //输出的excel文件工作表名
		String[] title = {"序号" , "患者姓名" , "年龄", "性别", "地域", "病种", "初筛医院", "复筛医院", "录入时间", "联系方式" }; //excel工作表的标题

		WritableWorkbook workbook;

		try {

			//创建可写入的Excel工作薄,运行生成的文件在tomcat/bin下
			//workbook = Workbook.createWorkbook(new File("output.xls"));
			System.out.println("begin" );

			OutputStream os=new  FileOutputStream(targetfile);
			workbook=Workbook.createWorkbook(os);

			WritableSheet sheet = workbook.createSheet(worksheet, 0 );  //添加第一个工作表
			//WritableSheet sheet1 = workbook.createSheet("MySheet1", 1); //可添加第二个工作
			/*
			jxl.write.Label label = new jxl.write.Label(0, 2, "A label record"); //put a label in cell A3, Label(column,row)
			sheet.addCell(label);
			*/

			//添加带有字体颜色,带背景颜色 Formatting的对象
			WritableFont wft = new  WritableFont(WritableFont.ARIAL, 10 ,WritableFont.BOLD, false ,UnderlineStyle.NO_UNDERLINE,Colour.BLACK);
			WritableCellFormat wcfFT = new  WritableCellFormat(wft);
			wcfFT.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
			wcfFT.setAlignment(Alignment.CENTRE);

			WritableFont wfcc = new  WritableFont(WritableFont.ARIAL, 10 ,WritableFont.NO_BOLD, false ,UnderlineStyle.NO_UNDERLINE,Colour.BLACK);
			WritableCellFormat wfcf = new  WritableCellFormat(wfcc);
			wfcf.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
			wfcf.setAlignment(Alignment.CENTRE);
			//wcfFC.setBackground(jxl.format.Colour.BLUE);
			//jxl.write.Label labelCFC = new  jxl.write.Label( 1 , 5 , "带颜色" ,wcfFC);
			//sheet.addCell(labelCFC);

			//合并单元格
			//sheet.mergeCells(int col1,int row1,int col2,int row2);//左上角到右下角
			sheet.mergeCells(0, 0, 9, 1); //左上角到右下角
			WritableFont wfc = new  WritableFont(WritableFont.ARIAL, 20 ,WritableFont.BOLD, false ,UnderlineStyle.NO_UNDERLINE,Colour.BLACK);
			WritableCellFormat wchB = new  WritableCellFormat(wfc);
			wchB.setAlignment(Alignment.CENTRE);
			wchB.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
			Label labelCFC = new  Label( 0 , 0 , "患者信息统计" ,wchB);
			sheet.addCell(labelCFC); //

			Label label;
			for  ( int  i= 0 ; i<title.length; i++)
			{
				//Label(列号,行号 ,内容 )
				label = new  Label(i,  2, title[i], wcfFT);  //put the title in row1
				sheet.addCell(label);
			}

			//判断表中是否有数据
            if (objData != null && objData.size() > 0) {
                //循环写入表中数据
                for (int i = 0; i < objData.size(); i++) {

                    //转换成map集合{activyName:测试功能,count:2}
                    Map<String, Object> map = (Map<String, Object>)objData.get(i);

                    //循环输出map中的子集：既列值
                    sheet.addCell(new Label(0, i + 3, String.valueOf(map.get("id")), wfcf));
                    sheet.addCell(new Label(1, i + 3, String.valueOf(map.get("patientName")), wfcf));
                    sheet.addCell(new Label(2, i + 3, String.valueOf(map.get("age")), wfcf));
                    //sheet.addCell(new Label(3, i + 3, String.valueOf(map.get("sex")), wfcf));
                    System.out.println("'" + String.valueOf(map.get("sex")) + "'");
                    if (String.valueOf(map.get("sex")).equals("0")) {
                    	//System.out.println("男");
                    	sheet.addCell(new Label(3, i + 3, "男", wfcf));
                    } else {
                    	//System.out.println("女");
                    	sheet.addCell(new Label(3, i + 3, "女", wfcf));
                    }
                    sheet.addCell(new Label(4, i + 3, String.valueOf(map.get("areaName")), wfcf));
                    sheet.addCell(new Label(5, i + 3, String.valueOf(map.get("first_desc")), wfcf));
                    sheet.addCell(new Label(6, i + 3, String.valueOf(map.get("hospital")), wfcf));
                    sheet.addCell(new Label(7, i + 3, String.valueOf(map.get("fchospital")), wfcf));
                    sheet.addCell(new Label(8, i + 3, String.valueOf(map.get("createTime")), wfcf));
                    sheet.addCell(new Label(9, i + 3, String.valueOf(map.get("phone")), wfcf));
//                    for(Object o:map.keySet()){
//                        //ps：因为要“”通用”“导出功能，所以这里循环的时候不是get("Name"),而是通过map.get(o)
//                    	sheet.addCell(new Label(j,i+3,String.valueOf(map.get(o)), wfcf));
//                        j++;
//                    }
                }
            }else{
            	System.out.println("没有数据.");
                //flag = -1;
            }

			//下列添加的对字体等的设置均调试通过，可作参考用


			//添加数字
			//jxl.write.Number number = new  jxl.write.Number( 3 ,  4 ,  3.14159 );  //put the number 3.14159 in cell D5
			//sheet.addCell(number);

			//添加带有字型Formatting的对象
			//jxl.write.WritableFont wf = new  jxl.write.WritableFont(WritableFont.TIMES, 10 ,WritableFont.BOLD, true );
			//jxl.write.WritableCellFormat wcfF = new  jxl.write.WritableCellFormat(wf);
			//jxl.write.Label labelCF = new  jxl.write.Label( 4 , 4 , "文本" ,wcfF);
			//sheet.addCell(labelCF);

			//添加带有formatting的Number对象
			//jxl.write.NumberFormat nf = new  jxl.write.NumberFormat( "#.##" );
			//jxl.write.WritableCellFormat wcfN = new  jxl.write.WritableCellFormat(nf);
			//jxl.write.Number labelNF = new  jxl.write.Number( 1 , 1 , 3.1415926 ,wcfN);
			//sheet.addCell(labelNF);

			//3.添加Boolean对象
			//jxl.write.Boolean labelB = new  jxl.write.Boolean( 0 , 2 , false );
			//sheet.addCell(labelB);

			//4.添加DateTime对象
			//jxl.write.DateTime labelDT = new  jxl.write.DateTime( 0 , 3 , new  java.util.Date());
			//sheet.addCell(labelDT);

			//添加带有formatting的DateFormat对象
			//jxl.write.DateFormat df = new  jxl.write.DateFormat( "ddMMyyyyhh:mm:ss" );
			//jxl.write.WritableCellFormat wcfDF = new  jxl.write.WritableCellFormat(df);
			//jxl.write.DateTime labelDTF = new  jxl.write.DateTime( 1 , 3 , new  java.util.Date(),wcfDF);
			//sheet.addCell(labelDTF);

			//设置边框
			//jxl.write.WritableCellFormat wcsB = new  jxl.write.WritableCellFormat();
			//wcsB.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THICK);
			//labelCFC = new  jxl.write.Label( 0 , 6 , "边框设置" ,wcsB);
			//sheet.addCell(labelCFC);

			workbook.write();
			workbook.close();
			 //关闭流
            os.flush();
            os.close();

		} catch (Exception e) {
			e.printStackTrace();
		}

		System.out.println("end" );
    }

	/**
     * @author
     * @param objData 导出内容数组
     * @param sheetName 导出工作表的名称
     * @param columns 导出Excel的表头数组
     * @return
     */
    public static int exportToExcel(HttpServletResponse response, List<Map<String, Object>> objData, String sheetName, List<String> columns) {
        int flag = 0;
        //声明工作簿jxl.write.WritableWorkbook
        WritableWorkbook wwb;
        try {
            //根据传进来的file对象创建可写入的Excel工作薄
            OutputStream os = response.getOutputStream();

            wwb = Workbook.createWorkbook(os);

            /*
             * 创建一个工作表、sheetName为工作表的名称、"0"为第一个工作表
             * 打开Excel的时候会看到左下角默认有3个sheet、"sheet1、sheet2、sheet3"这样
             * 代码中的"0"就是sheet1、其它的一一对应。
             * createSheet(sheetName, 0)一个是工作表的名称，另一个是工作表在工作薄中的位置
             */
            WritableSheet ws = wwb.createSheet(sheetName, 0);

            SheetSettings ss = ws.getSettings();
            ss.setVerticalFreeze(1);//冻结表头

            WritableFont font1 =new WritableFont(WritableFont.createFont("微软雅黑"), 10 ,WritableFont.BOLD);
            WritableFont font2 =new WritableFont(WritableFont.createFont("微软雅黑"), 9 ,WritableFont.NO_BOLD);
            WritableCellFormat wcf = new WritableCellFormat(font1);
            WritableCellFormat wcf2 = new WritableCellFormat(font2);
            WritableCellFormat wcf3 = new WritableCellFormat(font2);//设置样式，字体

            //创建单元格样式
            //WritableCellFormat wcf = new WritableCellFormat();

            //背景颜色
            wcf.setBackground(Colour.YELLOW);
            wcf.setAlignment(Alignment.CENTRE);  //平行居中
            wcf.setVerticalAlignment(VerticalAlignment.CENTRE);  //垂直居中
            wcf3.setAlignment(Alignment.CENTRE);  //平行居中
            wcf3.setVerticalAlignment(VerticalAlignment.CENTRE);  //垂直居中
            wcf3.setBackground(Colour.LIGHT_ORANGE);
            wcf2.setAlignment(Alignment.CENTRE);  //平行居中
            wcf2.setVerticalAlignment(VerticalAlignment.CENTRE);  //垂直居中

            /*
             * 这个是单元格内容居中显示
             * 还有很多很多样式
             */
            wcf.setAlignment(Alignment.CENTRE);

            //判断一下表头数组是否有数据
            if (columns != null && columns.size() > 0) {

                //循环写入表头
                for (int i = 0; i < columns.size(); i++) {

                    /*
                     * 添加单元格(Cell)内容addCell()
                     * 添加Label对象Label()
                     * 数据的类型有很多种、在这里你需要什么类型就导入什么类型
                     * 如：jxl.write.DateTime 、jxl.write.Number、jxl.write.Label
                     * Label(i, 0, columns[i], wcf)
                     * 其中i为列、0为行、columns[i]为数据、wcf为样式
                     * 合起来就是说将columns[i]添加到第一行(行、列下标都是从0开始)第i列、样式为什么"色"内容居中
                     */
                    ws.addCell(new Label(i, 0, columns.get(i), wcf));
                }

                //判断表中是否有数据
                if (objData != null && objData.size() > 0) {
                    //循环写入表中数据
                    for (int i = 0; i < objData.size(); i++) {

                        //转换成map集合{activyName:测试功能,count:2}
                        Map<String, Object> map = (Map<String, Object>)objData.get(i);

                        //循环输出map中的子集：既列值
                        int j=0;
                        for(Object o:map.keySet()){
                            //ps：因为要“”通用”“导出功能，所以这里循环的时候不是get("Name"),而是通过map.get(o)
                            ws.addCell(new Label(j,i+1,String.valueOf(map.get(o))));
                            j++;
                        }
                    }
                }else{
                    flag = -1;
                }

                //写入Excel工作表
                wwb.write();

                //关闭Excel工作薄对象
                wwb.close();

                //关闭流
                os.flush();
                os.close();

                os =null;
            }
        }catch (IllegalStateException e) {
            System.err.println(e.getMessage());
        }
        catch (Exception ex) {
            flag = 0;
            ex.printStackTrace();
        }

        return flag;
    }

    public static void doctorToExcel(HttpServletResponse response, List<Map<String, Object>> objData, String sheetName, List<String> columns) {

		WritableWorkbook workbook;
		try {
			OutputStream os = response.getOutputStream();
			workbook=Workbook.createWorkbook(os);

			WritableSheet sheet = workbook.createSheet(sheetName, 0 );  //添加第一个工作表

			WritableFont wft = new  WritableFont(WritableFont.ARIAL, 10 ,WritableFont.BOLD, false ,UnderlineStyle.NO_UNDERLINE,Colour.BLACK);
			WritableCellFormat wcfFT = new WritableCellFormat(wft);
			wcfFT.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
			//wcfFT.setWrap(true);
			WritableFont wfcc = new  WritableFont(WritableFont.ARIAL, 10 ,WritableFont.NO_BOLD, false ,UnderlineStyle.NO_UNDERLINE,Colour.BLACK);
			WritableCellFormat wfcf = new  WritableCellFormat(wfcc);
			wfcf.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
			wfcf.setWrap(true);

			//合并单元格
			//sheet.mergeCells(int col1,int row1,int col2,int row2);//左上角到右下角
			sheet.mergeCells(0, 0, 24, 1); //左上角到右下角
			WritableFont wfc = new  WritableFont(WritableFont.ARIAL, 20 ,WritableFont.BOLD, false ,UnderlineStyle.NO_UNDERLINE,Colour.BLACK);
			WritableCellFormat wchB = new  WritableCellFormat(wfc);
			wchB.setAlignment(Alignment.CENTRE);
			wchB.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);

			Label labelCFC = new  Label( 0 , 0 , "医生信息统计" ,wchB);
			sheet.addCell(labelCFC);
			sheet.setColumnView(3, 10);
			sheet.setColumnView(7, 25);
			sheet.setColumnView(9, 12);
			sheet.setColumnView(10, 12);
			sheet.setColumnView(11, 28);
			sheet.setColumnView(12, 28);
			sheet.setColumnView(13, 28);
			sheet.setColumnView(14, 28);
			sheet.setColumnView(15, 28);
			sheet.setColumnView(16, 28);
			sheet.setColumnView(17, 28);
			sheet.setColumnView(18, 28);
			sheet.setColumnView(19, 28);
			sheet.setColumnView(20, 28);
			sheet.setColumnView(21, 28);
			sheet.setColumnView(22, 28);
			sheet.setColumnView(23, 28);
			sheet.setColumnView(24, 12);
//			jxl.write.Label label;
//			for  ( int  i= 0 ; i<title.length; i++)
//			{
//				//Label(列号,行号 ,内容 )
//				label = new  jxl.write.Label(i,  2, title[i], wcfFT);  //put the title in row1
//				sheet.addCell(label);
//			}

			//循环写入表头
            for (int i = 0; i < columns.size(); i++) {

                /*
                 * 添加单元格(Cell)内容addCell()
                 * 添加Label对象Label()
                 * 数据的类型有很多种、在这里你需要什么类型就导入什么类型
                 * 如：jxl.write.DateTime 、jxl.write.Number、jxl.write.Label
                 * Label(i, 0, columns[i], wcf)
                 * 其中i为列、0为行、columns[i]为数据、wcf为样式
                 * 合起来就是说将columns[i]添加到第一行(行、列下标都是从0开始)第i列、样式为什么"色"内容居中
                 */
            	sheet.addCell(new Label(i, 2, columns.get(i), wcfFT));
            }

			//判断表中是否有数据
            if (objData != null && objData.size() > 0) {
                //循环写入表中数据
                for (int i = 0; i < objData.size(); i++) {

                    //转换成map集合{activyName:测试功能,count:2}
                    Map<String, Object> map = (Map<String, Object>)objData.get(i);

                    //循环输出map中的子集：既列值
                    sheet.addCell(new Label(0, i + 3, String.valueOf(i+1), wfcf));
                    String patientName = String.valueOf(map.get("realname"));
                    if (patientName == null || patientName.equals("null") || patientName.equals("")) {
                    	patientName = "/";
                    }
                    sheet.addCell(new Label(1, i + 3, patientName, wfcf));
                    if (String.valueOf(map.get("sex")).equals("0")) {
                    	//System.out.println("男");
                    	sheet.addCell(new Label(2, i + 3, "男", wfcf));
                    } else {
                    	//System.out.println("女");
                    	sheet.addCell(new Label(2, i + 3, "女", wfcf));
                    }
                    String title = String.valueOf(map.get("title"));
                    if (title == null || title.equals("null") || title.equals("")) {
                    	title = "/";
                    }
                    sheet.addCell(new Label(3, i + 3, title, wfcf));
                    sheet.addCell(new Label(4, i + 3, String.valueOf(map.get("provincename")), wfcf));
                    sheet.addCell(new Label(5, i + 3, String.valueOf(map.get("cityname")), wfcf));
                    sheet.addCell(new Label(6, i + 3, String.valueOf(map.get("areaName")), wfcf));
                    sheet.addCell(new Label(7, i + 3, String.valueOf(map.get("hospitalname")), wfcf));
                    sheet.addCell(new Label(8, i + 3, String.valueOf(map.get("loginCount")), wfcf));
                    sheet.addCell(new Label(9, i + 3, String.valueOf(map.get("mobilePhone")), wfcf));

                    //上报确诊例数
                    String comfirmNum = String.valueOf(map.get("comfirmNum"));
                    if (comfirmNum == null || comfirmNum.equals("null") || comfirmNum.equals("")) {
                    	comfirmNum = "0";
                    }
                    sheet.addCell(new Label(10, i + 3, comfirmNum, wfcf));

//                    //总录入患儿数量
//                    String totalPatientNum = String.valueOf(map.get("totalPatientNum"));
//                    if (totalPatientNum == null || totalPatientNum.equals("null") || totalPatientNum.equals("")) {
//                    	totalPatientNum = "0";
//                    }
//                    sheet.addCell(new Label(11, i + 3, totalPatientNum, wfcf));
//
//                    //年度患儿数量
//                    String yearNewPatientNum = String.valueOf(map.get("yearNewPatientNum"));
//                    if (yearNewPatientNum == null || yearNewPatientNum.equals("null") || yearNewPatientNum.equals("")) {
//                    	yearNewPatientNum = "0";
//                    }
//                    sheet.addCell(new Label(12, i + 3, yearNewPatientNum, wfcf));
//
//                    //年度新生儿数量
//                    String yearNewBirthNum = String.valueOf(map.get("yearNewBirthNum"));
//                    if (yearNewBirthNum == null || yearNewBirthNum.equals("null") || yearNewBirthNum.equals("")) {
//                    	yearNewBirthNum = "0";
//                    }
//                    sheet.addCell(new Label(13, i + 3, yearNewBirthNum, wfcf));



//                    sheet.addCell(new Label(14, i + 3, String.valueOf(map.get("coverRate")), wfcf));
//                    sheet.addCell(new Label(15, i + 3, String.valueOf(map.get("comfirmRate")), wfcf));

                  //1月0-6岁患儿数量
                    String Jan = String.valueOf(map.get("Jan"));
                    if (Jan == null || Jan.equals("null") || Jan.equals("")) {
                    	Jan = "0";
                    }
                    sheet.addCell(new Label(11, i + 3, Jan, wfcf));
                  //2月0-6岁患儿数量
                    String Feb = String.valueOf(map.get("Feb"));
                    if (Feb == null || Feb.equals("null") || Feb.equals("")) {
                    	Feb = "0";
                    }
                    sheet.addCell(new Label(12, i + 3, Feb, wfcf));

                  //3月0-6岁患儿数量
                    String Mar = String.valueOf(map.get("Mar"));
                    if (Mar == null || Mar.equals("null") || Mar.equals("")) {
                    	Mar = "0";
                    }
                    sheet.addCell(new Label(13, i + 3, Mar, wfcf));
                  //4月0-6岁患儿数量
                    String Apr = String.valueOf(map.get("Apr"));
                    if (Apr == null || Apr.equals("null") || Apr.equals("")) {
                    	Apr = "0";
                    }
                    sheet.addCell(new Label(14, i + 3, Apr, wfcf));

                  //5月0-6岁患儿数量
                    String May = String.valueOf(map.get("May"));
                    if (May == null || May.equals("null") || May.equals("")) {
                    	May = "0";
                    }
                    sheet.addCell(new Label(15, i + 3, May, wfcf));
                  //6月0-6岁患儿数量
                    String Jun = String.valueOf(map.get("lastMonthNum"));
                    if (Jun == null || Jun.equals("null") || Jun.equals("")) {
                    	Jun = "0";
                    }
                    sheet.addCell(new Label(16, i + 3, Jun, wfcf));

                  //7月0-6岁患儿数量
                    String Jul = String.valueOf(map.get("Jul"));
                    if (Jul == null || Jul.equals("null") || Jul.equals("")) {
                    	Jul = "0";
                    }
                    sheet.addCell(new Label(17, i + 3, Jul, wfcf));
                  //8月0-6岁患儿数量
                    String Aug = String.valueOf(map.get("Aug"));
                    if (Aug == null || Aug.equals("null") || Aug.equals("")) {
                    	Aug = "0";
                    }
                    sheet.addCell(new Label(18, i + 3, Aug, wfcf));

                  //9月0-6岁患儿数量
                    String Sep = String.valueOf(map.get("Sep"));
                    if (Sep == null || Sep.equals("null") || Sep.equals("")) {
                    	Sep = "0";
                    }
                    sheet.addCell(new Label(19, i + 3, Sep, wfcf));
                  //10月0-6岁患儿数量
                    String Oct = String.valueOf(map.get("Oct"));
                    if (Oct == null || Oct.equals("null") || Oct.equals("")) {
                    	Oct = "0";
                    }
                    sheet.addCell(new Label(20, i + 3, Oct, wfcf));

                  //11月0-6岁患儿数量
                    String Nov = String.valueOf(map.get("Nov"));
                    if (Nov == null || Nov.equals("null") || Nov.equals("")) {
                    	Nov = "0";
                    }
                    sheet.addCell(new Label(21, i + 3, Nov, wfcf));
                  //12月0-6岁患儿数量
                    String Dec = String.valueOf(map.get("Dec"));
                    if (Dec == null || Dec.equals("null") || Dec.equals("")) {
                    	Dec = "0";
                    }
                    sheet.addCell(new Label(22, i + 3, Dec, wfcf));

                  //今年0-6岁患儿数量
                    String thisYearNum = String.valueOf(map.get("thisYearNum"));
                    if (thisYearNum == null || thisYearNum.equals("null") || thisYearNum.equals("")) {
                    	thisYearNum = "0";
                    }
                    sheet.addCell(new Label(23, i + 3, thisYearNum, wfcf));



                    //有照片患儿数量
                    String hasPicNum = String.valueOf(map.get("hasPicNum"));
                    if (hasPicNum == null || hasPicNum.equals("null") || hasPicNum.equals("")) {
                    	hasPicNum = "0";
                    }
                    sheet.addCell(new Label(24, i + 3, hasPicNum, wfcf));

                }

                //写入Excel工作表
                workbook.write();

                //关闭Excel工作薄对象
                workbook.close();

                //关闭流
                os.flush();
                os.close();

                os =null;
            }else{
            	System.out.println("没有数据.");
            	//写入Excel工作表
                workbook.write();

                //关闭Excel工作薄对象
                workbook.close();

                //关闭流
                os.flush();
                os.close();

                os =null;
                //flag = -1;
            }

		} catch (Exception e) {
			e.printStackTrace();
		}

	}

    /**
     * 下载excel
     * @author
     * @param response
     * @param filename 文件名 ,如:20110808.xls
     * @param listData 数据源
     * @param sheetName 表头名称
     * @param columns 列名称集合,如：{物品名称，数量，单价}
     */
    public static void exportexcle(HttpServletResponse response, String filename, List<Map<String, Object>> listData, String sheetName, List<String> columns)
    {
        //调用上面的方法、生成Excel文件
        response.setContentType("application/vnd.ms-excel");
        //response.setHeader("Content-Disposition", "attachment;filename="+filename);
        try {
            response.setHeader("Content-Disposition", "attachment;filename=" + new String(filename.getBytes("gb2312"), "ISO8859-1") + ".xls");

            exportToExcel(response, listData, sheetName, columns);
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }


    }

    /**
     * 红包信息导出
     * @param redBagList
     * @param sheetName
     * @param columns
     */
	public static void redBagToExcel(HttpServletResponse response,
			List<Map<String, String>> redBagList, List<Map<String, String>> redBagSta,
			String sheetName,List<String> columns) {

		OutputStream os = null;
		WritableWorkbook workbook = null;

		try{
			os = response.getOutputStream();
			workbook=Workbook.createWorkbook(os);
			WritableSheet sheet = workbook.createSheet(sheetName, 0 ); //添加第一个工作表

			WritableFont wft = new  WritableFont(WritableFont.ARIAL, 10 ,WritableFont.BOLD, false ,UnderlineStyle.NO_UNDERLINE,Colour.BLACK);
			WritableCellFormat wcfFT = new WritableCellFormat(wft);
			wcfFT.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
			//wcfFT.setWrap(true);
			WritableFont wfcc = new  WritableFont(WritableFont.ARIAL, 10 ,WritableFont.NO_BOLD, false ,UnderlineStyle.NO_UNDERLINE,Colour.BLACK);
			WritableCellFormat wfcf = new  WritableCellFormat(wfcc);
			wfcf.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
			wfcf.setWrap(true);

			//合并单元格
			//sheet.mergeCells(int col1,int row1,int col2,int row2);//左上角到右下角
			sheet.mergeCells(0, 0, 6, 1); //左上角到右下角
			WritableFont wfc = new  WritableFont(WritableFont.ARIAL, 20 ,WritableFont.BOLD, false ,UnderlineStyle.NO_UNDERLINE,Colour.BLACK);
			WritableCellFormat wchB = new  WritableCellFormat(wfc);
			wchB.setAlignment(Alignment.CENTRE);
			wchB.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);

			Label labelCFC = new  Label( 0 , 0 , "红包信息统计" ,wchB);
			sheet.addCell(labelCFC); 
			
			//设置列宽
			sheet.setColumnView(1, 30);
			sheet.setColumnView(4, 10);
			sheet.setColumnView(5, 10);
			sheet.setColumnView(6, 25);
			
			//循环写入表头  
            for (int i = 0; i < columns.size(); i++) {  

            	sheet.addCell(new Label(i, 2, columns.get(i), wcfFT));  
            } 
            
            if(redBagList != null || redBagList.size() != 0){
            	
            	//循环写出数据
            	for(int i = 0;i<redBagList.size();i++){
            		
            		Map<String,String> redBag = redBagList.get(i);
            		
            		//在Excel列里面写出红包信息
            		
            		sheet.addCell(new Label(0,i+3,String.valueOf(i+1),wfcf));  //序号
            		sheet.addCell(new Label(1,i+3,String.valueOf(redBag.get("wish")),wfcf));   //信息
            		sheet.addCell(new Label(2,i+3,String.valueOf(redBag.get("money")),wfcf));  //金额
            		sheet.addCell(new Label(3,i+3,String.valueOf(redBag.get("bagNum")),wfcf));   //个数
            		sheet.addCell(new Label(4,i+3,String.valueOf(redBag.get("lyMoney")),wfcf));   //领用金额
            		sheet.addCell(new Label(5,i+3,String.valueOf(redBag.get("lyBagNum")),wfcf));   //领用个数
            		sheet.addCell(new Label(6,i+3,String.valueOf(redBag.get("createTime")),wfcf));   //时间
            		
            	}
            	
            	//写入总金额 和领用金额
            	
            	sheet.addCell(new Label(0,redBagList.size()+3,"统计",wfcf));
            	sheet.addCell(new Label(1,redBagList.size()+3,"",wfcf));
            	sheet.addCell(new Label(2,redBagList.size()+3,
            			String.valueOf(redBagSta.get(0).get("totalMoney")),wfcf));
            	sheet.addCell(new Label(3,redBagList.size()+3,"",wfcf));
            	sheet.addCell(new Label(4,redBagList.size()+3,
            			String.valueOf(redBagSta.get(0).get("lyMoney")),wfcf));
            	sheet.addCell(new Label(5,redBagList.size()+3,"",wfcf));
            	sheet.addCell(new Label(6,redBagList.size()+3,"",wfcf));
            	//写入Excel工作表
                workbook.write();  
            }
            
            //关闭Excel工作薄对象   
            workbook.close();  
              
            //关闭流  
            os.flush();  
            os.close();  
              
            os =null; 
            
		}catch(Exception e){
			e.printStackTrace();
		}
			
	}

	/**
	 * 婴幼儿健康状况调查表导出
	 * @param response
	 * @param babyHealth
	 * @param sheetName
	 * @throws Exception 
	 */
	public static void babyHealthToExcel(HttpServletResponse response,
			Map<String, Object> babyHealth, String sheetName) throws Exception {
		
		OutputStream os = response.getOutputStream();
		WritableWorkbook workbook = Workbook.createWorkbook(os);
		
		try{
			
			//添加第一个工作表
			WritableSheet sheet = workbook.createSheet(sheetName, 0);
			
			//第一种画笔
			WritableFont wft = new WritableFont(WritableFont.ARIAL,16,WritableFont.BOLD,false,UnderlineStyle.NO_UNDERLINE, Colour.BLACK);
			WritableCellFormat wcfmt = new WritableCellFormat(wft);
			wcfmt.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
			wcfmt.setAlignment(Alignment.CENTRE);
			wcfmt.setWrap(true);
			
			//第二种画笔
			WritableFont wft1 = new WritableFont(WritableFont.ARIAL,10,WritableFont.NO_BOLD,false,UnderlineStyle.NO_UNDERLINE,Colour.BLACK);
			WritableCellFormat wcfmt1 = new WritableCellFormat(wft1);
			wcfmt1.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
			wcfmt1.setWrap(true);
			
			//第三种画笔
			WritableFont wft2 = new WritableFont(WritableFont.ARIAL,10,WritableFont.BOLD,false,UnderlineStyle.NO_UNDERLINE,Colour.BLACK);
			WritableCellFormat wcfmt2 = new WritableCellFormat(wft2);
			wcfmt2.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
			wcfmt2.setWrap(true);
			
			//设置列宽
			sheet.setColumnView(0, 9);
			sheet.setColumnView(1, 9);
			sheet.setColumnView(2, 9);
			sheet.setColumnView(3, 9);
			sheet.setColumnView(4, 10);
			sheet.setColumnView(5, 9);
			sheet.setColumnView(6, 9);
			sheet.setColumnView(7, 9);
			sheet.setColumnView(8, 9);
			sheet.setColumnView(9, 9);
			sheet.setColumnView(10, 10);
			sheet.setColumnView(11, 9);
			sheet.setColumnView(12, 9);
			sheet.setColumnView(13, 9);
			
			//设置行高
			sheet.setRowView(0, 800);
			sheet.setRowView(1, 400);
			sheet.setRowView(2, 400);
			sheet.setRowView(3, 400);
			sheet.setRowView(4, 400);
			sheet.setRowView(5, 400);
			sheet.setRowView(6, 400);
			sheet.setRowView(7, 400);
			sheet.setRowView(8, 400);
			sheet.setRowView(9, 400);
			sheet.setRowView(10, 400);
			sheet.setRowView(11, 400);
			sheet.setRowView(12, 400);
			sheet.setRowView(13, 400);
			sheet.setRowView(14, 400);
			sheet.setRowView(15, 400);
			sheet.setRowView(16, 400);
			sheet.setRowView(17, 400);
			sheet.setRowView(18, 400);
			sheet.setRowView(19, 400);
			sheet.setRowView(20, 400);
			sheet.setRowView(21, 400);
			sheet.setRowView(22, 400);
			sheet.setRowView(23, 400);
			sheet.setRowView(24, 400);
			
			//写出内容
			//表头
			//合并单元格
			sheet.mergeCells(0, 0, 13, 0);
			//添加内容
			sheet.addCell(new Label(0,0,"安徽省婴幼儿健康状况调查表",wcfmt));
			//编号行
			sheet.mergeCells(0, 1, 10, 1);
			sheet.addCell(new Label(0, 1, "", wcfmt1));
			sheet.addCell(new Label(11, 1,"编号", wcfmt1));
			sheet.mergeCells(12, 1, 13 ,1 );
			String id = String.valueOf(babyHealth.get("id"));    //编号
			sheet.addCell(new Label(12, 1, id, wcfmt1));
			
			//第一行
			sheet.mergeCells(0, 2, 1, 2);
			sheet.addCell(new Label(0,2,"检查单位",wcfmt1));
			sheet.mergeCells(2, 2, 6, 2);
			String hospital = String.valueOf(babyHealth.get("hospital"));
			if(StringUtils.isBlank(hospital)||hospital.equals("null")){
				hospital = "/";
			}
			sheet.addCell(new Label(2,2,hospital,wcfmt1));
			
			sheet.mergeCells(7, 2, 8, 2);
			sheet.addCell(new Label(7,2,"出生证号码",wcfmt1));
			sheet.mergeCells(9, 2, 13, 2);
			String birthNum = String.valueOf(babyHealth.get("birthNum"));
			if(StringUtils.isBlank(birthNum)||birthNum.equals("null")){
				birthNum = "/";
			}
			sheet.addCell(new Label(9,2,birthNum,wcfmt1));
			
			//第二行
			sheet.mergeCells(0, 3, 1, 3);
			sheet.addCell(new Label(0,3,"婴儿姓名",wcfmt1));
			sheet.mergeCells(2, 3, 6, 3);
			String patientName = String.valueOf(babyHealth.get("patientName"));
			if(StringUtils.isBlank(patientName)||patientName.equals("null")){
				patientName = "/";
			}
			sheet.addCell(new Label(2,3,patientName,wcfmt1));
			
			sheet.mergeCells(7, 3, 8, 3);
			sheet.addCell(new Label(7,3,"性别",wcfmt1));
			sheet.mergeCells(9, 3, 13, 3);
			String sex = String.valueOf(babyHealth.get("sex"));
			if(StringUtils.isBlank(sex)||sex.equals("null")){
				sex = "/";
			}else{
				if("0".equals(sex)){
					sex = "男";
				}else if("1".equals(sex)){
					sex = "女";
				}else{
					sex = "/";
				}
			}
			
			sheet.addCell(new Label(9,3,sex,wcfmt1));
			
			//第三行
			sheet.mergeCells(0, 4, 1, 4);
			sheet.addCell(new Label(0,4,"出生时间",wcfmt1));
			sheet.mergeCells(2, 4, 6, 4);
			String birthday = String.valueOf(babyHealth.get("birthday"));
			String birthTime = String.valueOf(babyHealth.get("birthTime"));
			if(StringUtils.isBlank(birthday)||birthday.equals("null")){
				birthday = " / 年  / 月  / 日   ";
			}else{
				System.out.println("birthday = " + birthday);
				birthday = " " + birthday.substring(0,4) + " 年 "
						 + " " + birthday.substring(5,7) + " 月  "
						 + " " + birthday.substring(8,10) + " 日 ";
			}
			if(StringUtils.isBlank(birthTime)||birthTime.equals("null")){
				birthTime = " / 时";
			}else{
				birthTime = " " + birthTime + " 时";
			}
			
			sheet.addCell(new Label(2,4,(birthday + birthTime) ,wcfmt1));
			
			sheet.mergeCells(7, 4, 8, 4);
			sheet.addCell(new Label(7,4,"调查日期",wcfmt1));
			sheet.mergeCells(9, 4, 13, 4);
			String createTime = String.valueOf(babyHealth.get("createTime"));
			if(StringUtils.isBlank(createTime)||createTime.equals("null")){
				createTime = " / 年  / 月  / 日   ";
			}else{
				createTime = " " + createTime.substring(0,4) + " 年 "
						   + " " + createTime.substring(5,7) + " 月  "
						   + " " + createTime.substring(8,10) + " 日 ";
			}
			String surveyTime = String.valueOf(babyHealth.get("surveyTime"));
			if(StringUtils.isBlank(surveyTime)||surveyTime.equals("null")){
				surveyTime = " / 时";
			}else{
				surveyTime = " " + surveyTime + " 时";
			}
			sheet.addCell(new Label(9,4,(createTime + surveyTime),wcfmt1));
			
			//第四行
			sheet.mergeCells(0, 5, 1, 5);
			sheet.addCell(new Label(0,5,"母亲姓名",wcfmt1));
			String mum = String.valueOf(babyHealth.get("mum"));
			if(StringUtils.isBlank(mum)||mum.equals("null")){
				mum = "/";
			}
			sheet.addCell(new Label(2,5,mum,wcfmt1));
			
			sheet.addCell(new Label(3,5,"民族",wcfmt1));
			String mumNation = String.valueOf(babyHealth.get("mumNation"));
			if(StringUtils.isBlank(mumNation)||mumNation.equals("null")){
				mumNation = "/";
			}
			sheet.addCell(new Label(4,5,mumNation,wcfmt1));
			
			sheet.addCell(new Label(5,5,"学历",wcfmt1));
			String mumEducation = String.valueOf(babyHealth.get("mumEducation"));
			if(StringUtils.isBlank(mumEducation)||mumEducation.equals("null")){
				mumEducation = "/";
			}
			sheet.addCell(new Label(6,5,mumEducation,wcfmt1));
			
			sheet.mergeCells(7, 5, 8, 5);
			sheet.addCell(new Label(7,5,"联系电话",wcfmt1));
			sheet.mergeCells(9, 5, 13, 5);
			String mumTel = String.valueOf(babyHealth.get("mumTel"));
			if(StringUtils.isBlank(mumTel)||mumTel.equals("null")){
				mumTel = "/";
			}
			sheet.addCell(new Label(9,5,mumTel,wcfmt1));
			
			//第五行
			sheet.mergeCells(0, 6, 1, 6);
			sheet.addCell(new Label(0,6,"父亲姓名",wcfmt1));
			String dad = String.valueOf(babyHealth.get("dad"));
			if(StringUtils.isBlank(dad)||dad.equals("null")){
				dad = "/";
			}
			sheet.addCell(new Label(2,6,dad,wcfmt1));
			
			sheet.addCell(new Label(3,6,"民族",wcfmt1));
			String dadNation = String.valueOf(babyHealth.get("dadNation"));
			if(StringUtils.isBlank(dadNation)||dadNation.equals("null")){
				dadNation = "/";
			}
			sheet.addCell(new Label(4,6,dadNation,wcfmt1));
			
			sheet.addCell(new Label(5,6,"学历",wcfmt1));
			String dadEducation = String.valueOf(babyHealth.get("dadEducation"));
			if(StringUtils.isBlank(dadEducation)||dadEducation.equals("null")){
				dadEducation = "/";
			}
			sheet.addCell(new Label(6,6,dadEducation,wcfmt1));
			
			sheet.mergeCells(7, 6, 8, 6);
			sheet.addCell(new Label(7,6,"联系电话",wcfmt1));
			sheet.mergeCells(9, 6, 13, 6);
			String dadTel = String.valueOf(babyHealth.get("dadTel"));
			if(StringUtils.isBlank(dadTel)||dadTel.equals("null")){
				dadTel = "/";
			}
			sheet.addCell(new Label(9,6,dadTel,wcfmt1));
			
			//第六行
			sheet.mergeCells(0, 7, 1, 7);
			sheet.addCell(new Label(0,7,"家庭住址",wcfmt1));
			sheet.mergeCells(2, 7, 6, 7);
			String address = String.valueOf(babyHealth.get("address"));
			if(StringUtils.isBlank(address)||address.equals("null")){
				address = "/";
			}
			sheet.addCell(new Label(2,7,address,wcfmt1));
			
			sheet.mergeCells(7, 7, 8, 7);
			sheet.addCell(new Label(7,7,"户籍",wcfmt1));
			sheet.mergeCells(9, 7, 13, 7);
			String register = String.valueOf(babyHealth.get("register"));
			if(StringUtils.isBlank(register)||register.equals("null")){
				register = "/";
			}
			sheet.addCell(new Label(9,7,register,wcfmt1));
			
			//第七行
			sheet.mergeCells(0, 8, 6, 8);
			sheet.addCell(new Label(0,8,"家族血亲三代有无血管瘤或脉管畸形病史",wcfmt2));
			sheet.mergeCells(7, 8, 13, 8);
			String jzsxm = String.valueOf(babyHealth.get("jzsxm"));
			if(StringUtils.isBlank(jzsxm)||jzsxm.equals("null")){
				jzsxm = "/";
			}else{
				if("0".equals(jzsxm)){
					jzsxm = "否";
				}else if("1".equals(jzsxm)){
					jzsxm = "是";
				}else{
					jzsxm = "/";
				}
			}
			sheet.addCell(new Label(7,8,jzsxm,wcfmt1));
			
			//第八行
			sheet.mergeCells(0, 9, 6, 9);
			sheet.addCell(new Label(0,9,"兄弟姐妹有无血管瘤或脉管畸形病史",wcfmt2));
			sheet.mergeCells(7, 9, 13, 9);
			String xdjmxm = String.valueOf(babyHealth.get("xdjmxm"));
			if(StringUtils.isBlank(xdjmxm)||xdjmxm.equals("null")){
				xdjmxm = "/";
			}else{
				if("0".equals(xdjmxm)){
					xdjmxm = "否";
				}else if("1".equals(xdjmxm)){
					xdjmxm = "是";
				}else{
					xdjmxm = "/";
				}
			}
			sheet.addCell(new Label(7,9,xdjmxm,wcfmt1));
			
			//第九行
			sheet.mergeCells(0, 10, 1, 10);
			sheet.addCell(new Label(0,10,"孕产史",wcfmt2));
			String yunChan = String.valueOf(babyHealth.get("yunChan"));
			if(StringUtils.isBlank(yunChan)||yunChan.equals("null")){
				yunChan = "/";
			}else{
				if("0".equals(yunChan)){
					yunChan = "否";
				}else if("1".equals(yunChan)){
					yunChan = "是";
				}else{
					yunChan = "/";
				}
			}
			sheet.addCell(new Label(2,10,yunChan,wcfmt1));
			
			sheet.addCell(new Label(3,10,"孕"));
			String yunNum = String.valueOf(babyHealth.get("yunNum"));
			if(StringUtils.isBlank(yunNum)||yunNum.equals("null")){
				yunNum = "/";
			}
			sheet.addCell(new Label(4,10,yunNum + " 次",wcfmt1));
			
			sheet.addCell(new Label(5,10,"产"));
			String chanNum = String.valueOf(babyHealth.get("chanNum"));
			if(StringUtils.isBlank(chanNum)||chanNum.equals("null")){
				chanNum = "/";
			}
			sheet.addCell(new Label(6,10,chanNum + " 胎",wcfmt1));
			
			sheet.mergeCells(7, 10, 8, 10);
			sheet.addCell(new Label(7,10,"此孩怀孕年龄",wcfmt1));
			sheet.mergeCells(9, 10, 13, 10);
			String yunAge = String.valueOf(babyHealth.get("yunAge"));
			if(StringUtils.isBlank(yunAge)||yunAge.equals("null")){
				yunAge = "/";
			}
			sheet.addCell(new Label(9,10,yunAge,wcfmt1));
			
			//第十行
			sheet.mergeCells(0, 11, 1, 11);
			sheet.addCell(new Label(0,11,"孕期药物治疗史",wcfmt2));
			sheet.addCell(new Label(2,11,"黄体酮",wcfmt1));
			String drugHistory = String.valueOf(babyHealth.get("drugHistory"));
			drugHistory = drugHistory.replace("0", "×");
			drugHistory = drugHistory.replace("1", "√");
			
			sheet.addCell(new Label(3,11,"" + drugHistory.charAt(0),wcfmt1));
			sheet.addCell(new Label(4,11,"雌激素",wcfmt1));
			sheet.addCell(new Label(5,11,"" + drugHistory.charAt(1),wcfmt1));
			sheet.addCell(new Label(6,11,"氯米芬",wcfmt1));
			sheet.addCell(new Label(7,11,"" + drugHistory.charAt(2),wcfmt1));
			sheet.addCell(new Label(8,11,"克罗米芬",wcfmt1));
			sheet.addCell(new Label(9,11,"" + drugHistory.charAt(3),wcfmt1));
			sheet.addCell(new Label(10,11,"其他",wcfmt1));
			sheet.mergeCells(11, 11, 13, 11);
			String drugOther = String.valueOf(babyHealth.get("drugOther"));
			if(StringUtils.isBlank(drugOther)||drugOther.equals("null")){
				drugOther = "/";
			}
			sheet.addCell(new Label(11,11,drugOther,wcfmt1));
			
			//第十一行
			sheet.mergeCells(0, 12, 6, 12);
			sheet.addCell(new Label(0,12,"孕期有家庭装修史",wcfmt2));
			sheet.mergeCells(7, 12, 13, 12);
			String yunFitment = String.valueOf(babyHealth.get("yunFitment"));
			if(StringUtils.isBlank(yunFitment)||yunFitment.equals("null")){
				yunFitment = "/";
			}else{
				if("0".equals(yunFitment)){
					yunFitment = "否";
				}else if("1".equals(yunFitment)){
					yunFitment = "是";
				}else{
					yunFitment = "/";
				}
			}
			sheet.addCell(new Label(7,12,yunFitment,wcfmt1));
			
			//第十二行
			sheet.mergeCells(0, 13, 6, 13);
			sheet.addCell(new Label(0,13,"母亲有无视频显示终端暴露（VDTs）",wcfmt2));
			sheet.mergeCells(7, 13, 13, 13);
			String VDTs = String.valueOf(babyHealth.get("VDTs"));
			if(StringUtils.isBlank(VDTs)||VDTs.equals("null")){
				VDTs = "/";
			}else{
				if("0".equals(VDTs)){
					VDTs = "否";
				}else if("1".equals(VDTs)){
					VDTs = "是";
				}else{
					VDTs = "/";
				}
			}
			sheet.addCell(new Label(7,13,VDTs,wcfmt1));
			
			//第十三行
			sheet.mergeCells(0, 14, 1, 14);
			sheet.addCell(new Label(0,14,"母亲饮水",wcfmt2));
			sheet.addCell(new Label(2,14,"自来水",wcfmt1));
			String mumDrink = String.valueOf(babyHealth.get("mumDrink"));
			mumDrink = mumDrink.replace("0", "×");
			mumDrink = mumDrink.replace("1", "√");
			sheet.addCell(new Label(3,14,"" + mumDrink.charAt(0),wcfmt1));
			sheet.addCell(new Label(4,14,"井水",wcfmt1));
			sheet.addCell(new Label(5,14,"" + mumDrink.charAt(1),wcfmt1));
			sheet.addCell(new Label(6,14,"河水",wcfmt1));
			sheet.addCell(new Label(7,14,"" + mumDrink.charAt(2),wcfmt1));
			sheet.mergeCells(8, 14, 13, 14);
			sheet.addCell(new Label(8,14,"",wcfmt1));
			
			//第十四行
			sheet.mergeCells(0, 15, 6, 15);
			sheet.addCell(new Label(0,15,"孕期有无其他化学物质接触史",wcfmt2));
			sheet.mergeCells(7, 15, 13, 15);
			String chemicalContact = String.valueOf(babyHealth.get("chemicalContact"));
			if(StringUtils.isBlank(chemicalContact)||chemicalContact.equals("null")){
				chemicalContact = "/";
			}else{
				if("0".equals(chemicalContact)){
					chemicalContact = "否";
				}else if("1".equals(chemicalContact)){
					chemicalContact = "是";
				}else{
					chemicalContact = "/";
				}
			}
			sheet.addCell(new Label(7,15,chemicalContact,wcfmt1));
			
			//第十五行
			sheet.mergeCells(0, 16, 1, 16);
			sheet.addCell(new Label(0,16,"羊膜检测",wcfmt2));
			sheet.mergeCells(2, 16, 13, 16);
			String amnioscopy = String.valueOf(babyHealth.get("amnioscopy"));
			if(StringUtils.isBlank(amnioscopy)||amnioscopy.equals("null")){
				amnioscopy = "/";
			}else{
				if("0".equals(amnioscopy)){
					amnioscopy = "否";
				}else if("1".equals(amnioscopy)){
					amnioscopy = "是";
				}else{
					amnioscopy = "/";
				}
			}
			sheet.addCell(new Label(2,16,amnioscopy,wcfmt1));
			
			//第十六行
			sheet.mergeCells(0, 17, 1, 17);
			sheet.addCell(new Label(0,17,"羊膜囊穿刺",wcfmt2));
			sheet.mergeCells(2, 17, 13, 17);
			String amniocentesis = String.valueOf(babyHealth.get("amniocentesis"));
			if(StringUtils.isBlank(amniocentesis)||amniocentesis.equals("null")){
				amniocentesis = "/";
			}else{
				if("0".equals(amniocentesis)){
					amniocentesis = "否";
				}else if("1".equals(amniocentesis)){
					amniocentesis = "是";
				}else{
					amniocentesis = "/";
				}
			}
			sheet.addCell(new Label(2,17,amniocentesis,wcfmt1));
			
			//第十七行
			sheet.mergeCells(0, 18, 3, 18);
			sheet.addCell(new Label(0,18,"母亲孕期有无外伤史或是腹部撞击史",wcfmt2));
			sheet.mergeCells(4, 18, 4, 18);
			String hurted = String.valueOf(babyHealth.get("hurted"));
			if(StringUtils.isBlank(hurted)||hurted.equals("null")){
				hurted = "/";
			}else{
				if("0".equals(hurted)){
					hurted = "否";
				}else if("1".equals(hurted)){
					hurted = "是";
				}else{
					hurted = "/";
				}
			}
			sheet.addCell(new Label(4,18,hurted,wcfmt1));
			
			sheet.mergeCells(5, 18, 5, 18);
			sheet.addCell(new Label(5,18,"过敏源",wcfmt2));
			sheet.mergeCells(6, 18, 6, 18);
			String gmy = String.valueOf(babyHealth.get("gmy"));
			if(StringUtils.isBlank(gmy)||gmy.equals("null")){
				gmy = "/";
			}else{
				if("0".equals(gmy)){
					gmy = "否";
				}else if("1".equals(gmy)){
					gmy = "是";
				}else{
					gmy = "/";
				}
			}
			sheet.addCell(new Label(6,18,gmy,wcfmt1));
			
			sheet.mergeCells(7, 18, 8, 18);
			sheet.addCell(new Label(7,18,"具体过敏源",wcfmt2));
			sheet.mergeCells(9, 18, 13, 18);
			String gmyDetail = String.valueOf(babyHealth.get("gmyDetail"));
			if(StringUtils.isBlank(gmyDetail)||gmyDetail.equals("null")){
				gmyDetail = "/";
			}
			sheet.addCell(new Label(9,18,gmyDetail,wcfmt1));
			
			//第十八行
			sheet.mergeCells(0, 19, 1, 19);
			sheet.addCell(new Label(0,19,"血常规",wcfmt2));
			sheet.addCell(new Label(2,19,"血小板"));
			String bloodPlatelet = String.valueOf(babyHealth.get("bloodPlatelet"));
			if(StringUtils.isBlank(bloodPlatelet)||bloodPlatelet.equals("null")){
				bloodPlatelet = "/";
			}else{
				if("0".equals(bloodPlatelet)){
					bloodPlatelet = "正常";
				}else if("1".equals(bloodPlatelet)){
					bloodPlatelet = "下降";
				}else{
					bloodPlatelet = "/";
				}
			}
			sheet.addCell(new Label(3,19,bloodPlatelet,wcfmt1));
			sheet.addCell(new Label(4,19,"血VEGF",wcfmt1));
			sheet.mergeCells(5, 19, 6, 19);
			String VEGF = String.valueOf(babyHealth.get("VEGF"));
			if(StringUtils.isBlank(VEGF)||VEGF.equals("null")){
				VEGF = "/";
			}
			sheet.addCell(new Label(5,19,VEGF,wcfmt1));
			sheet.mergeCells(7, 19, 13, 19);
			sheet.addCell(new Label(7,19,"",wcfmt1));
			
			//第十九 二十行
			sheet.mergeCells(0, 20, 1, 21);
			sheet.addCell(new Label(0, 20, "孕期伴随情况",wcfmt2));
			String yunCase = String.valueOf(babyHealth.get("yunCase"));
			yunCase = yunCase.replace("0", "×");
			yunCase = yunCase.replace("1", "√");
			sheet.addCell(new Label(2, 20, "多胎妊娠",wcfmt1));
			sheet.addCell(new Label(3, 20, ""+yunCase.charAt(0),wcfmt1));
			sheet.addCell(new Label(4, 20, "单卵",wcfmt1));
			sheet.addCell(new Label(5, 20, ""+yunCase.charAt(1),wcfmt1));
			sheet.addCell(new Label(6, 20, "双卵",wcfmt1));
			sheet.addCell(new Label(7, 20, ""+yunCase.charAt(2),wcfmt1));
			sheet.addCell(new Label(8, 20, "先兆子痫",wcfmt1));
			sheet.addCell(new Label(9, 20, ""+yunCase.charAt(3),wcfmt1));
			sheet.addCell(new Label(10, 20, "前置胎盘",wcfmt1));
			sheet.addCell(new Label(11, 20, ""+yunCase.charAt(4),wcfmt1));
			sheet.addCell(new Label(12, 20, "早产",wcfmt1));
			sheet.addCell(new Label(13, 20, ""+yunCase.charAt(5),wcfmt1));
			
			sheet.addCell(new Label(2, 21, "先兆流产",wcfmt1));
			sheet.addCell(new Label(3, 21, ""+yunCase.charAt(6),wcfmt1));
			sheet.addCell(new Label(4, 21, "妊娠高血压",wcfmt1));
			sheet.addCell(new Label(5, 21, ""+yunCase.charAt(7),wcfmt1));
			sheet.addCell(new Label(6, 21, "胎位不正",wcfmt1));
			sheet.addCell(new Label(7, 21, ""+yunCase.charAt(8),wcfmt1));
			sheet.addCell(new Label(8, 21, "糖尿病",wcfmt1));
			sheet.addCell(new Label(9, 21, ""+yunCase.charAt(9)));
			sheet.addCell(new Label(10, 21, "病毒性肝炎",wcfmt1));
			sheet.addCell(new Label(11, 21, ""+yunCase.charAt(10),wcfmt1));
			sheet.mergeCells(12, 21, 13, 21);
			sheet.addCell(new Label(12, 21, "",wcfmt1));
			
			//第二十一行
			sheet.mergeCells(0, 22, 1, 22);
			sheet.addCell(new Label(0, 22, "儿童出生情况",wcfmt2));
			
			sheet.addCell(new Label(2, 22, "出生地",wcfmt1));
			sheet.mergeCells(3, 22, 7, 22);
			String birthPlace = String.valueOf(babyHealth.get("birthPlace"));
			if(StringUtils.isBlank(birthPlace)||birthPlace.equals("null")){
				birthPlace = "/";
			}
			sheet.addCell(new Label(3, 22, birthPlace,wcfmt1));
			
			sheet.addCell(new Label(8, 22, "出生体重",wcfmt1));
			String birthWeight = String.valueOf(babyHealth.get("birthWeight"));
			if(StringUtils.isBlank(birthWeight)||birthWeight.equals("null")){
				birthWeight = "/";
			}
			sheet.addCell(new Label(9, 22, birthWeight,wcfmt1));
			
			sheet.mergeCells(10, 22, 11, 22);
			sheet.addCell(new Label(10, 22, "是否人工助孕",wcfmt1));
			sheet.mergeCells(12, 22, 13, 22);
			String rgYun = String.valueOf(babyHealth.get("rgYun"));
			if(StringUtils.isBlank(rgYun)||rgYun.equals("null")){
				rgYun = "/";
			}else{
				if("0".equals(rgYun)){
					rgYun = "否";
				}else if("1".equals(rgYun)){
					rgYun = "是";
				}else{
					rgYun = "/";
				}
			}
			sheet.addCell(new Label(12, 22, rgYun,wcfmt1));
			
			//第二十二行
			sheet.mergeCells(0, 23, 1, 23);
			sheet.addCell(new Label(0, 23, "儿童健康状况",wcfmt2));
			sheet.mergeCells(2, 23, 13, 23);
			String birthHealth = String.valueOf(babyHealth.get("birthHealth"));
			if(StringUtils.isBlank(birthHealth)||birthHealth.equals("null")){
				birthHealth = "/";
			}
			sheet.addCell(new Label(2, 23, birthHealth,wcfmt1));
			
			//第二十三行
			sheet.mergeCells(0, 24, 9, 24);
			sheet.addCell(new Label(0, 24, "",wcfmt1));
			sheet.mergeCells(10, 24, 11, 24);
			sheet.addCell(new Label(10, 24, "调查医生",wcfmt1));
			sheet.mergeCells(12, 24, 13, 24);
			String doctorName = String.valueOf(babyHealth.get("doctorName"));
			sheet.addCell(new Label(12, 24, doctorName,wcfmt1));
			
			workbook.write(); 
			
		}finally{
			 //关闭Excel工作薄对象   
            workbook.close();  
            //关闭流  
            os.flush();  
            os.close();  
		}
		
		
	}




	public static void test(HttpServletResponse response, String titleName, String sheetName, List<String> columns) throws IOException, WriteException {

		OutputStream os = null;
		WritableWorkbook workbook = null;

		try {

			os = response.getOutputStream();
			workbook = Workbook.createWorkbook(os);

			WritableSheet sheet = workbook.createSheet(sheetName, 0);

			//创建画笔
			//第一种画笔
			WritableFont wft = new WritableFont(WritableFont.ARIAL,20,WritableFont.BOLD,false,UnderlineStyle.NO_UNDERLINE,Colour.BLACK);
			WritableCellFormat wcfmt = new WritableCellFormat(wft);
			wcfmt.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
			//设置水平居中
			wcfmt.setAlignment(Alignment.CENTRE);
			//设置垂直居中
			wcfmt.setVerticalAlignment(VerticalAlignment.CENTRE);
			wcfmt.setWrap(true);

			//第二种画笔
			WritableFont wft1 = new WritableFont(WritableFont.ARIAL,10,WritableFont.NO_BOLD,false,UnderlineStyle.NO_UNDERLINE,Colour.BLACK);
			WritableCellFormat wcfmt1 = new WritableCellFormat(wft1);
			wcfmt1.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
			wcfmt1.setAlignment(Alignment.CENTRE);

			//第三种画笔
			WritableFont wft2 = new WritableFont(WritableFont.ARIAL,12,WritableFont.BOLD,false,UnderlineStyle.NO_UNDERLINE,Colour.BLACK);
			WritableCellFormat wcfmt2 = new WritableCellFormat(wft2);
			wcfmt2.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
			//设置水平居中
			wcfmt2.setAlignment(Alignment.CENTRE);
			//设置垂直居中
			wcfmt2.setVerticalAlignment(VerticalAlignment.CENTRE);
			wcfmt2.setWrap(true);

			//设置列宽
			sheet.setColumnView(0, 15);
			sheet.setColumnView(1, 30);
			sheet.setColumnView(2, 30);
			sheet.setColumnView(3, 15);
			sheet.setColumnView(4, 30);

			//写入表头
			sheet.mergeCells(0, 0, columns.size()-1, 0);
			sheet.addCell(new Label(0, 0, titleName, wcfmt));
			sheet.setRowView(0, 1000);

			//循环写入
			for(int i = 0 ; i< columns.size(); i ++ ){
				sheet.addCell(new Label (i,1,columns.get(i), wcfmt2));
			}
			sheet.setRowView(1, 450);

			int i = 0;


			workbook.write();
		} catch (RowsExceededException e) {
			e.printStackTrace();
		} catch (WriteException e) {
			e.printStackTrace();
		} finally {
			workbook.close();
			os.flush();
			os.close();
		}
	}
	public static void task(HttpServletResponse response, String titleName, String sheetName, List<String> columns) throws IOException, WriteException {

		OutputStream os = null;
		WritableWorkbook workbook = null;

		try {

			os = response.getOutputStream();
			workbook = Workbook.createWorkbook(os);

			WritableSheet sheet = workbook.createSheet(sheetName, 0);

			//创建画笔
			//第一种画笔
			WritableFont wft = new WritableFont(WritableFont.ARIAL,20,WritableFont.BOLD,false,UnderlineStyle.NO_UNDERLINE,Colour.BLACK);
			WritableCellFormat wcfmt = new WritableCellFormat(wft);
			wcfmt.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
			//设置水平居中
			wcfmt.setAlignment(Alignment.CENTRE);
			//设置垂直居中
			wcfmt.setVerticalAlignment(VerticalAlignment.CENTRE);
			wcfmt.setWrap(true);

			//第二种画笔
			WritableFont wft1 = new WritableFont(WritableFont.ARIAL,10,WritableFont.NO_BOLD,false,UnderlineStyle.NO_UNDERLINE,Colour.BLACK);
			WritableCellFormat wcfmt1 = new WritableCellFormat(wft1);
			wcfmt1.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
			wcfmt1.setAlignment(Alignment.CENTRE);

			//第三种画笔
			WritableFont wft2 = new WritableFont(WritableFont.ARIAL,12,WritableFont.BOLD,false,UnderlineStyle.NO_UNDERLINE,Colour.BLACK);
			WritableCellFormat wcfmt2 = new WritableCellFormat(wft2);
			wcfmt2.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
			//设置水平居中
			wcfmt2.setAlignment(Alignment.CENTRE);
			//设置垂直居中
			wcfmt2.setVerticalAlignment(VerticalAlignment.CENTRE);
			wcfmt2.setWrap(true);

			//设置列宽
			sheet.setColumnView(0, 15);
			sheet.setColumnView(1, 30);
			sheet.setColumnView(2, 30);
			sheet.setColumnView(3, 15);
			sheet.setColumnView(4, 30);

			//写入表头
			sheet.mergeCells(0, 0, columns.size()-1, 0);
			sheet.addCell(new Label(0, 0, titleName, wcfmt));
			sheet.setRowView(0, 1000);

			//循环写入
			for(int i = 0 ; i< columns.size(); i ++ ){
				sheet.addCell(new Label (i,1,columns.get(i), wcfmt2));
			}
			sheet.setRowView(1, 450);

			int i = 0;


			workbook.write();
		} catch (RowsExceededException e) {
			e.printStackTrace();
		} catch (WriteException e) {
			e.printStackTrace();
		} finally {
			workbook.close();
			os.flush();
			os.close();
		}
	}
	public static void babyHealthAllToExcel(HttpServletResponse response,
			List<Map<String, Object>> reportList, String sheetName,
			List<String> columns, String code) throws Exception {
		
		OutputStream os = null;
		WritableWorkbook workbook = null;
		
		try{
			
			os = response.getOutputStream();
			workbook = Workbook.createWorkbook(os);
			
			WritableSheet sheet = workbook.createSheet("复筛流行病学科研统计表", 0);
		
			//创建画笔
			//第一种画笔
			WritableFont wft = new WritableFont(WritableFont.ARIAL,20,WritableFont.BOLD,false,UnderlineStyle.NO_UNDERLINE,Colour.BLACK);
			WritableCellFormat wcfmt = new WritableCellFormat(wft);
			wcfmt.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
			//设置水平居中
			wcfmt.setAlignment(Alignment.CENTRE);
			//设置垂直居中
			wcfmt.setVerticalAlignment(VerticalAlignment.CENTRE);
			wcfmt.setWrap(true);
			
			//第二种画笔
			WritableFont wft1 = new WritableFont(WritableFont.ARIAL,10,WritableFont.NO_BOLD,false,UnderlineStyle.NO_UNDERLINE,Colour.BLACK);
			WritableCellFormat wcfmt1 = new WritableCellFormat(wft1);
			wcfmt1.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
			wcfmt1.setAlignment(Alignment.CENTRE);
			//设置垂直居中
			wcfmt1.setVerticalAlignment(VerticalAlignment.CENTRE);
			wcfmt1.setWrap(true);
			
			//第三种画笔
			WritableFont wft2 = new WritableFont(WritableFont.ARIAL,12,WritableFont.BOLD,false,UnderlineStyle.NO_UNDERLINE,Colour.BLACK);
			WritableCellFormat wcfmt2 = new WritableCellFormat(wft2);
			wcfmt2.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
			//设置水平居中
			wcfmt2.setAlignment(Alignment.CENTRE);
			//设置垂直居中
			wcfmt2.setVerticalAlignment(VerticalAlignment.CENTRE);
			wcfmt2.setWrap(true);
			
			//设置列宽
			sheet.setColumnView(0, 8);
			sheet.setColumnView(1, 12);
			sheet.setColumnView(2, 12);
			sheet.setColumnView(3, 12);
			sheet.setColumnView(4, 16);
			sheet.setColumnView(5, 16);
			sheet.setColumnView(6, 16);
			sheet.setColumnView(6, 8);
			sheet.setColumnView(7, 24);
			sheet.setColumnView(8, 24);
			sheet.setColumnView(9, 12);
			sheet.setColumnView(10, 12);
			sheet.setColumnView(11, 12);
			sheet.setColumnView(12, 12);
			sheet.setColumnView(13, 12);
			sheet.setColumnView(16, 12);
			sheet.setColumnView(17, 12);
			sheet.setColumnView(18, 12);
			sheet.setColumnView(19, 8);
			sheet.setColumnView(20, 22);
			sheet.setColumnView(21, 22);
			sheet.setColumnView(22, 22);
			sheet.setColumnView(23, 22);
			sheet.setColumnView(24, 22);
			sheet.setColumnView(25, 22);
			sheet.setColumnView(26, 32);
			sheet.setColumnView(27, 40);
			sheet.setColumnView(28, 12);
			sheet.setColumnView(29, 16);
			sheet.setColumnView(30, 36);
			sheet.setColumnView(31, 22);
			sheet.setColumnView(32, 16);
			sheet.setColumnView(33, 16);
			sheet.setColumnView(34, 16);
			sheet.setColumnView(35, 12);
			sheet.setColumnView(36, 12);
			sheet.setColumnView(37, 24);
			sheet.setColumnView(38, 24);
			sheet.setColumnView(39, 24);
			sheet.setColumnView(40, 16);
			
			//设置行高
			

			//写入表头
			sheet.mergeCells(0, 0, columns.size()-1, 0);
			sheet.addCell(new Label(0, 0, sheetName, wcfmt));
			sheet.setRowView(0, 1000);
			
			
			//循环写入
			for(int i = 0 ; i< columns.size(); i ++ ){
				sheet.addCell(new Label (i,1,columns.get(i),wcfmt2));
			}
			sheet.setRowView(1, 450);
			
			//写入数据(有数据时)
			
			if(reportList != null && reportList.size() != 0){
				
				for(int i = 0 ; i<reportList.size(); i++){
					//获取复筛报告
					Map<String,Object> report = reportList.get(i);
					//序号
					sheet.addCell(new Label(0 , i + 2 , "" + (i + 1), wcfmt1));
					//复筛日期
					String createTime = ""+ report.get("createTime");
					if(StringUtils.isBlank(createTime)||"null".equals(createTime)){
						createTime = "/";
					} else {
						createTime = createTime.substring(0, 10);
					}
					sheet.addCell(new Label(1 , i + 2 ,createTime,wcfmt1));
					//姓名
					String patientName = "" + report.get("patientName");
					if(StringUtils.isBlank(patientName)||"null".equals(patientName)) {
						patientName = "/";
					}
					sheet.addCell(new Label(2,i+2,patientName,wcfmt1));
					//检查单位
					String hospital = "" + report.get("hospital");
					sheet.addCell(new Label(3 ,i + 2 ,hospital , wcfmt1));
					/*
					String sex = "" + report.get("sex");
					String sex = "" + report.get("sex");
					if(StringUtils.isBlank(sex)||"null".equals(sex)){
						sex = "/";
					} else {
						if("0".equals(sex)){
							sex = "男";
						} else if ("1".equals(sex)){
							sex = "女";
						} else{
							sex = "/";
						}
					}
					sheet.addCell(new Label(3 ,i + 2 ,sex , wcfmt1));
					*/
					//出生证号码
					String birthNum = "" + report.get("birthNum");
					if(StringUtils.isBlank(birthNum)||"null".equals(birthNum)){
						birthNum = "/";
					}
					sheet.addCell(new Label(4 , i+2 , birthNum , wcfmt1));
					/*
					String ageMonth = "" + report.get("ageMonth");
					if(StringUtils.isBlank(ageMonth)||"null".equals(ageMonth)){
						ageMonth = "/";
					}
					sheet.addCell(new Label(4 , i+2 , ageMonth , wcfmt1));
					*/
					//身份证号码
					String sfzNum = "" + report.get("sfzNum");
					if(StringUtils.isBlank(sfzNum)||"null".equals(sfzNum)){
						sfzNum = "/";
					}
					sheet.addCell(new Label(5 , i+2 , sfzNum , wcfmt1));
					//性别
					String sex = "" + report.get("sex");
					if(StringUtils.isBlank(sex)||"null".equals(sex)){
						sex = "/";
					} else {
						if("0".equals(sex)){
							sex = "男";
						} else if ("1".equals(sex)){
							sex = "女";
						} else{
							sex = "/";
						}
					}
					sheet.addCell(new Label(6,i + 2 ,sex , wcfmt1));
					/*
					String register = "" + report.get("register");
					if(StringUtils.isBlank(register)||"null".equals(register)){
						register = "/";
					}
					sheet.addCell(new Label(5 , i+ 2 ,register , wcfmt1));
					*/
					//初筛日期：年 月 日 时
					String birthday = "" + report.get("birthday");
					String birthTime = "" + report.get("birthTime");
					if(StringUtils.isBlank(birthday)||birthday.equals("null")){
						birthday = " / 年  / 月  / 日   ";
					}else{
						birthday = " " + birthday.substring(0,4) + " 年 "
								 + " " + birthday.substring(5,7) + " 月  "
								 + " " + birthday.substring(8,10) + " 日 ";
					}
					if(StringUtils.isBlank(birthTime)||birthTime.equals("null")){
						birthTime = " / 时";
					}else{
						birthTime = " " + birthTime + " 时";
					}
					sheet.addCell(new Label(7, i+2, birthday + birthTime , wcfmt1));
					//检查日期： 年 月 日 时
					//String createTime = String.valueOf(report.get("createTime"));
					if(StringUtils.isBlank(createTime)||createTime.equals("null")){
						createTime = " / 年  / 月  / 日   ";
					}else{
						createTime = " " + createTime.substring(0,4) + " 年 "
								   + " " + createTime.substring(5,7) + " 月  "
								   + " " + createTime.substring(8,10) + " 日 ";
					}
					String surveyTime = String.valueOf(report.get("surveyTime"));
					if(StringUtils.isBlank(surveyTime)||surveyTime.equals("null")){
						surveyTime = " / 时";
					}else{
						surveyTime = " " + surveyTime + " 时";
					}
					sheet.addCell(new Label(8,i+2,createTime + surveyTime,wcfmt1));
					
					//母亲姓名： 名字： 民族： 学历
					String mum = "" + report.get("mum");
					if(StringUtils.isBlank(mum)||mum.equals("null")){
						mum = " / ";
					}
					String mumNation = "" + report.get("mumNation");
					if(StringUtils.isBlank(mumNation)||mumNation.equals("null")){
						mumNation = " / ";
					}
					String mumEducation = "" + report.get("mumEducation");
					if(StringUtils.isBlank(mumEducation)||mumEducation.equals("null")){
						mumEducation = " / ";
					}
					//sheet.addCell(new Label(9, i+2 , mum + ":" + mumNation + ":" + mumEducation , wcfmt1));
					sheet.addCell(new Label(9, i+2 , mum, wcfmt1));
					sheet.addCell(new Label(10, i+2 , mumNation, wcfmt1));
					sheet.addCell(new Label(11, i+2 , mumEducation, wcfmt1));
					/*
					String xmPart = "" + report.get("xmPart");
					String xmPart1 = "";
					if(StringUtils.isBlank(xmPart)||"null".equals(xmPart)){
						xmPart1  = "/";
					} else {

						if("1".equals("" + xmPart.charAt(0))){
							xmPart1 = xmPart1 + "头颈部   ";
						}
						if("1".equals("" + xmPart.charAt(1))){
							xmPart1 = xmPart1 + "四肢   ";
						}
						if("1".equals("" + xmPart.charAt(2))){
							xmPart1 = xmPart1 + "躯干   ";
						}
						if("1".equals("" + xmPart.charAt(3))){
							xmPart1 = xmPart1 + "内脏   ";
						}
					}
					sheet.addCell(new Label(8, i+2 , xmPart1 , wcfmt1));
					*/
					//联系方式
					String mumTel = "" + report.get("mumTel");
					if(StringUtils.isBlank(mumTel)||mumTel.equals("null")){
						mumTel = " / ";
					} else {
						// 不是管理员登录并且患儿信息部位空的话,隐藏患儿信息
						if ("admin".equals(code)) {
							if (mumTel.length() > 7) {
								mumTel =  mumTel.substring(0, 4) + "***" + mumTel.substring(7, mumTel.length());
							}
						}
					}
					sheet.addCell(new Label(12, i+2, mumTel , wcfmt1));
					/*
					String Becho = "" + report.get("Becho");
					if(StringUtils.isBlank(Becho)||"null".equals(Becho)){
						Becho = "/";
					} else {
						if("0".equals(Becho)){
							Becho = "否";
						} else if ("1".equals(Becho)){
							Becho = "是";
						} else {
							Becho = "/";
						}
					}
					sheet.addCell(new Label(9 , i+2, Becho , wcfmt1));
					*/
					//父亲姓名：民族： 学历
					String dad = "" + report.get("dad");
					if(StringUtils.isBlank(dad)||dad.equals("null")){
						dad = " / ";
					}
					String dadNation = "" + report.get("dadNation");
					if(StringUtils.isBlank(dadNation)||dadNation.equals("null")){
						dadNation = " / ";
					}
					String dadEducation = "" + report.get("dadEducation");
					if(StringUtils.isBlank(dadEducation)||dadEducation.equals("null")){
						dadEducation = " / ";
					}
					//sheet.addCell(new Label(13, i+2 , dad + ":" + dadNation + ":" + dadEducation , wcfmt1));
					sheet.addCell(new Label(13, i+2 , dad, wcfmt1));
					sheet.addCell(new Label(14, i+2 , dadNation, wcfmt1));
					sheet.addCell(new Label(15, i+2 , dadEducation, wcfmt1));
					/*
					String Bblood = "" + report.get("Bblood");
					if(StringUtils.isBlank(Bblood)||"null".equals(Bblood)){
						Bblood = "/";
					} else {
						if("0".equals(Bblood)){
							Bblood = "否";
						} else if ("1".equals(Bblood)){
							Bblood = "是";
						} else {
							Bblood = "/";
						}
					}
					sheet.addCell(new Label(10 , i+2, Bblood , wcfmt1));
					*/
					//联系电话
					String dadTel = "" + report.get("dadTel");
					if(StringUtils.isBlank(dadTel)||dadTel.equals("null")){
						dadTel = " / ";
					} else {
						// 不是管理员登录并且患儿信息部位空的话,隐藏患儿信息
						if ("admin".equals(code)) {
							if (dadTel.length() > 7) {
								dadTel =  dadTel.substring(0, 4) + "***" + dadTel.substring(7, dadTel.length());
							}
						}
					}
					sheet.addCell(new Label(16, i+2, dadTel , wcfmt1));
					/*
					String Borgan = "" + report.get("Borgan");
					if(StringUtils.isBlank(Borgan)||"null".equals(Borgan)){
						Borgan = "/";
					} else {
						if("0".equals(Borgan)){
							Borgan = "否";
						} else if ("1".equals(Borgan)){
							Borgan = "是";
						} else {
							Borgan = "/";
						}
					}
					sheet.addCell(new Label(11 , i+2, Borgan , wcfmt1));
					*/
					//年龄
					String ageMonth = "" + report.get("ageMonth");
					if(StringUtils.isBlank(ageMonth)||"null".equals(ageMonth)){
						ageMonth = "/";
					}
					sheet.addCell(new Label(17, i+2 , ageMonth , wcfmt1));
					/*
					String xmShape = "" + report.get("xmShape");
					String xmSize = "" + report.get("xmSize");
					
					if(StringUtils.isNotBlank(xmShape)&&!xmShape.equals("null")){
						if("0".equals(xmShape)){
							xmShape = "小红点";
						}else if("1".equals(xmShape)){
							xmShape = "绿豆大小";
						}else if("2".equals(xmShape)){
							xmShape = "硬币大小";
						}else if("3".equals(xmShape)){
							xmShape = "鸡蛋大小";
						}
						sheet.addCell(new Label(12 ,i+2 , xmShape , wcfmt1));
					}else if(StringUtils.isNotBlank(xmSize)&&!xmSize.equals("null")){
						
						if("0".equals(xmSize)){
							xmSize = "<1cm";
						}else if("1".equals(xmSize)){
							xmSize = ">1cm";
						}else if("2".equals(xmSize)){
							xmSize = ">3cm";
						}else if("3".equals(xmSize)){
							xmSize = ">5cm";
						}else if("4".equals(xmSize)){
							xmSize = ">10cm";
						}
						sheet.addCell(new Label(12 ,i+2 , xmSize , wcfmt1));	
					}
					*/
					//家庭住址
					
					String address = "" + report.get("address");
					sheet.addCell(new Label(18, i+2 , address , wcfmt1));
					/*
					String xmColor = "" + report.get("xmColor");
					String xmColor1 = "";
					if(StringUtils.isBlank(xmColor)||"null".equals(xmColor)){
						xmColor1  = "/";
					} else {

						if("1".equals("" + xmColor.charAt(0))){
							xmColor1 = xmColor1 + "肤色   ";
						}
						if("1".equals("" + xmColor.charAt(1))){
							xmColor1 = xmColor1 + "红色   ";
						}
						if("1".equals("" + xmColor.charAt(2))){
							xmColor1 = xmColor1 + "暗紫红色   ";
						}
						if("1".equals("" + xmColor.charAt(3))){
							xmColor1 = xmColor1 + "蓝色   ";
						}
						if("1".equals("" + xmColor.charAt(4))){
							xmColor1 = xmColor1 + "青色   ";
						}
						if("1".equals("" + xmColor.charAt(5))){
							xmColor1 = xmColor1 + "黑色   ";
						}
						if("1".equals("" + xmColor.charAt(6))){
							xmColor1 = xmColor1 + "褐色   ";
						}
						if("1".equals("" + xmColor.charAt(7))){
							xmColor1 = xmColor1 + "粉红色   ";
						}
						if("1".equals("" + xmColor.charAt(8))){
							xmColor1 = xmColor1 + "浅红色   ";
						}	
					}
					sheet.addCell(new Label(13, i+2 , xmColor1 , wcfmt1));
					*/
					
					//户籍
					String register = "" + report.get("register");
					sheet.addCell(new Label(19, i+2 , register , wcfmt1));
					/*
					String xmFall = "" + report.get("xmFall");
					if(StringUtils.isBlank(xmFall)||"null".equals(xmFall)){
						xmFall = "/";
					} else {
						if("0".equals(xmFall)){
							xmFall = "否";
						} else if ("1".equals(xmFall)){
							xmFall = "是";
						} else {
							xmFall = "/";
						}
					}
					sheet.addCell(new Label(14 , i+2, xmFall , wcfmt1));
					*/
					//家族血亲三代史
					String jzsxm = "" + report.get("jzsxm");
					if(StringUtils.isBlank(jzsxm)||"null".equals(jzsxm)){
						jzsxm = "/";
					} else {
						if("0".equals(jzsxm)){
							jzsxm = "否";
						} else if ("1".equals(jzsxm)){
							jzsxm = "是";
						} else {
							jzsxm = "/";
						}
					}
					sheet.addCell(new Label(20, i+2, jzsxm , wcfmt1));
					/*
					String skinRaised = "" + report.get("skinRaised");
					if(StringUtils.isBlank(skinRaised)||"null".equals(skinRaised)){
						skinRaised = "/";
					} else {
						if("0".equals(skinRaised)){
							skinRaised = "否";
						} else if ("1".equals(skinRaised)){
							skinRaised = "是";
						} else {
							skinRaised = "/";
						}
					}
					sheet.addCell(new Label(15 , i+2, skinRaised , wcfmt1));
					*/
					//父母兄弟姐妹史
					String xdjmxm = "" + report.get("xdjmxm");
					if(StringUtils.isBlank(xdjmxm)||"null".equals(xdjmxm)){
						xdjmxm = "/";
					} else {
						if("0".equals(xdjmxm)){
							xdjmxm = "否";
						} else if ("1".equals(xdjmxm)){
							xdjmxm = "是";
						} else {
							xdjmxm = "/";
						}
					}
					sheet.addCell(new Label(21, i+2, xdjmxm , wcfmt1));

					//母孕产史
					String yunChan = "" + report.get("yunChan");
					if(StringUtils.isBlank(yunChan)||"null".equals(yunChan)){
						yunChan = "/";
					} else {
						if("0".equals(yunChan)){
							yunChan = "否";
						} else if ("1".equals(yunChan)){
							yunChan = "是";
						} else {
							yunChan = "/";
						}
					}
					sheet.addCell(new Label(22, i+2, yunChan , wcfmt1));
					
					//此孩怀孕年龄
					String yunAge = "" + report.get("yunAge");
					if(StringUtils.isBlank(yunAge)||"null".equals(yunAge)){
						yunAge = "/";
					}
					sheet.addCell(new Label(23, i+2 ,yunAge , wcfmt1));
					
					//孕期药物治疗史
					String drugHistory = "" + report.get("drugHistory");
					String drugHistory1 = "/";
					if(StringUtils.isBlank(drugHistory)||"null".equals(drugHistory)){
						drugHistory1  = "/";
					} else {

						if("1".equals("" + drugHistory.charAt(0))){
							drugHistory1 = drugHistory1 + "黄体酮   ";
						}
						if("1".equals("" + drugHistory.charAt(1))){
							drugHistory1 = drugHistory1 + "雌激素   ";
						}
						if("1".equals("" + drugHistory.charAt(2))){
							drugHistory1 = drugHistory1 + "氯米芬   ";
						}
						if("1".equals("" + drugHistory.charAt(3))){
							drugHistory1 = drugHistory1 + "克罗米芬   ";
						}
					
					}
					sheet.addCell(new Label(24, i+2 , drugHistory1 , wcfmt1));
					
					//孕期有家庭装修史
					String yunFitment = "" + report.get("yunFitment");
					if(StringUtils.isBlank(yunFitment)||"null".equals(yunFitment)){
						yunFitment = "/";
					} else {
						if("0".equals(yunFitment)){
							yunFitment = "否";
						} else if ("1".equals(yunFitment)){
							yunFitment = "是";
						} else {
							yunFitment = "/";
						}
					}
					sheet.addCell(new Label(25, i+2, yunFitment , wcfmt1));
					//母亲有无视频显示终端暴露
					String VDTs = "" + report.get("VDTs");
					if(StringUtils.isBlank(VDTs)||"null".equals(VDTs)){
						VDTs = "/";
					} else {
						if("0".equals(VDTs)){
							VDTs = "否";
						} else if ("1".equals(VDTs)){
							VDTs = "是";
						} else {
							VDTs = "/";
						}
					}
					sheet.addCell(new Label(26, i+2, VDTs , wcfmt1));
					
					//母亲饮用水（自来水、井水、河水）
					String mumDrink = "" + report.get("mumDrink");
					String mumDrink1 = "";
					if(StringUtils.isBlank(mumDrink)||"null".equals(mumDrink)||"000".equals(mumDrink)){
						mumDrink1  = "/";
					} else {

						if("1".equals("" + mumDrink.charAt(0))){
							mumDrink1 = mumDrink1 + "自来水   ";
						}
						if("1".equals("" + mumDrink.charAt(1))){
							mumDrink1 = mumDrink1 + "井水   ";
						}
						if("1".equals("" + mumDrink.charAt(2))){
							mumDrink1 = mumDrink1 + "河水   ";
						}
					}
					sheet.addCell(new Label(27, i+2 , mumDrink1 , wcfmt1));		
					
					//羊膜检测
					String amnioscopy = "" + report.get("amnioscopy");
					if(StringUtils.isBlank(amnioscopy)||"null".equals(amnioscopy)){
						amnioscopy = "/";
					} else {
						if("0".equals(amnioscopy)){
							amnioscopy = "否";
						} else if ("1".equals(amnioscopy)){
							amnioscopy = "是";
						} else {
							amnioscopy = "/";
						}
					}
					sheet.addCell(new Label(28, i+2, amnioscopy , wcfmt1));
					
					//羊膜囊穿刺
					String amniocentesis = "" + report.get("amniocentesis");
					if(StringUtils.isBlank(amniocentesis)||"null".equals(amniocentesis)){
						amniocentesis = "/";
					} else {
						if("0".equals(amniocentesis)){
							amniocentesis = "否";
						} else if ("1".equals(amniocentesis)){
							amniocentesis = "是";
						} else {
							amniocentesis = "/";
						}
					}
					sheet.addCell(new Label(29 , i+2, amniocentesis , wcfmt1));
					
					//母亲孕期有无外伤史或腹部撞击史
					String hurted = "" + report.get("hurted");
					if(StringUtils.isBlank(hurted)||"null".equals(hurted)){
						hurted = "/";
					} else {
						if("0".equals(hurted)){
							hurted = "否";
						} else if ("1".equals(hurted)){
							hurted = "是";
						} else {
							hurted = "/";
						}
					}
					sheet.addCell(new Label(30 , i+2, hurted , wcfmt1));

					//过敏源（）无（）
					String gmy = "" + report.get("gmy");
					String gmyDetail = "" + report.get("gmyDetail");
					if(StringUtils.isBlank(gmy)||"null".equals(gmy)){
						gmy = "/";
					} else if ("1".equals(gmy)) {
						gmy = "有";
					} else if ("0".equals(gmy)) {
						gmy = "无";
					}
					if(StringUtils.isBlank(gmyDetail)||"null".equals(gmyDetail)){
						gmyDetail = "/";
					}
					sheet.addCell(new Label(31, i+2, gmy + ":" + gmyDetail, wcfmt1));
					
					//孕期伴随情况
					String yunCase = "" + report.get("yunCase");
					String yunCase1 = "/";
					if(StringUtils.isBlank(yunCase)||"null".equals(yunCase)){
						yunCase1  = "/";
					} else {

						if("1".equals("" + yunCase.charAt(0))){
							yunCase1 = yunCase1 + "多胎妊娠   ";
						}
						if("1".equals("" + yunCase.charAt(1))){
							yunCase1 = yunCase1 + "单卵   ";
						}
						if("1".equals("" + yunCase.charAt(2))){
							yunCase1 = yunCase1 + "双卵   ";
						}
						if("1".equals("" + yunCase.charAt(3))){
							yunCase1 = yunCase1 + "先兆子痫   ";
						}
						if("1".equals("" + yunCase.charAt(4))){
							yunCase1 = yunCase1 + "前置胎盘   ";
						}
						if("1".equals("" + yunCase.charAt(5))){
							yunCase1 = yunCase1 + "早产   ";
						}
						if("1".equals("" + yunCase.charAt(6))){
							yunCase1 = yunCase1 + "先兆流产   ";
						}
						if("1".equals("" + yunCase.charAt(7))){
							yunCase1 = yunCase1 + "妊娠高血压   ";
						}
						if("1".equals("" + yunCase.charAt(8))){
							yunCase1 = yunCase1 + "胎位不正   ";
						}
						if("1".equals("" + yunCase.charAt(9))){
							yunCase1 = yunCase1 + "糖尿病   ";
						}
						if("1".equals("" + yunCase.charAt(10))){
							yunCase1 = yunCase1 + "病毒性肝炎   ";
						}
							
					}
					sheet.addCell(new Label(32, i+2 , yunCase1 , wcfmt1));
					
					//是否早产儿
					String isPremature = "";
					if(StringUtils.isBlank(yunCase)||"null".equals(yunCase)){
						isPremature  = "/";
					} else {
						if("1".equals(""+ yunCase.charAt(5))){
							isPremature = "是";
						} else if ("0".equals(""+ yunCase.charAt(5))){
							isPremature = "否";
						} else {
							isPremature  = "/";
						}
					}
					sheet.addCell(new Label(33, i+2 , isPremature ,wcfmt1));
					
					//患儿出生地
					String birthPlace = "" + report.get("birthPlace");
					if(StringUtils.isBlank(birthPlace)||"null".equals(birthPlace)){
						birthPlace = "/";
					}
					sheet.addCell(new Label(34, i+2 ,birthPlace,wcfmt1));
					
					//出生体重
					String birthWeight = "" + report.get("birthWeight");
					if(StringUtils.isBlank(birthWeight)||"null".equals(birthWeight)){
						birthWeight = "/";
					}
					sheet.addCell(new Label(35, i+2 ,birthWeight,wcfmt1));	
					
					//医生姓名
					String docName = "" + report.get("doctorName");
					if(StringUtils.isBlank(docName)||"null".equals(docName)){
						docName = "/";
					}
					sheet.addCell(new Label(36, i+2 ,docName,wcfmt1));
					
					// 复筛确诊患儿姓名
					String fcName = "" + report.get("fcName");
					if(StringUtils.isBlank(fcName)||"null".equals(fcName)){
						fcName = "/";
					}
					sheet.addCell(new Label(37, i+2 ,fcName,wcfmt1));
					
					// 复筛确诊患儿性别
					String fcSex = "" + report.get("fcSex");
					if(StringUtils.isBlank(fcSex)||"null".equals(fcSex)){
						fcSex = "/";
					}
					sheet.addCell(new Label(38, i+2 ,fcSex,wcfmt1));
					
					// 复筛确诊患儿年龄
					String fcAge = "" + report.get("fcAge");
					if(StringUtils.isBlank(fcAge)||"null".equals(fcAge)){
						fcAge = "/";
					}
					sheet.addCell(new Label(39, i+2 ,fcAge,wcfmt1));
					 
					// 是否人工助孕
					String rgYun = "" + report.get("rgYun");
					if(StringUtils.isBlank(rgYun)||"null".equals(rgYun)){
						rgYun = "否";
					} else {
						if ("1".equals(rgYun)) {
							rgYun = "是";
						} else if ("0".equals(rgYun)) {
							rgYun = "否";
						} else {
							rgYun = "/";
						}
					}	
					sheet.addCell(new Label(40, i+2 , rgYun, wcfmt1));
				}

			}
			
			workbook.write();
			
		}finally{
			workbook.close();
			os.flush();
			os.close();
		}
		
	}  
	
	/**
	 * 导出复筛报告单-全部
	 * @param response
	 * @param reportList
	 * @param sheetName
	 * @param columns
	 * @throws Exception 
	 */
	public static void fcReportAllToExcel(HttpServletResponse response,
			List<Map<String, Object>> reportList, String sheetName,
			List<String> columns) throws Exception {
		
		OutputStream os = null;
		WritableWorkbook workbook = null;
		
		try{
			
			os = response.getOutputStream();
			workbook = Workbook.createWorkbook(os);
			
			WritableSheet sheet = workbook.createSheet("复筛流行病学科研统计表", 0);
		
			//创建画笔
			//第一种画笔
			WritableFont wft = new WritableFont(WritableFont.ARIAL,20,WritableFont.BOLD,false,UnderlineStyle.NO_UNDERLINE,Colour.BLACK);
			WritableCellFormat wcfmt = new WritableCellFormat(wft);
			wcfmt.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
			//设置水平居中
			wcfmt.setAlignment(Alignment.CENTRE);
			//设置垂直居中
			wcfmt.setVerticalAlignment(VerticalAlignment.CENTRE);
			wcfmt.setWrap(true);
			
			//第二种画笔
			WritableFont wft1 = new WritableFont(WritableFont.ARIAL,10,WritableFont.NO_BOLD,false,UnderlineStyle.NO_UNDERLINE,Colour.BLACK);
			WritableCellFormat wcfmt1 = new WritableCellFormat(wft1);
			wcfmt1.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
			//设置垂直居中
			wcfmt1.setVerticalAlignment(VerticalAlignment.CENTRE);
			wcfmt1.setWrap(true);
			
			//第三种画笔
			WritableFont wft2 = new WritableFont(WritableFont.ARIAL,12,WritableFont.BOLD,false,UnderlineStyle.NO_UNDERLINE,Colour.BLACK);
			WritableCellFormat wcfmt2 = new WritableCellFormat(wft2);
			wcfmt2.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
			//设置水平居中
			wcfmt2.setAlignment(Alignment.CENTRE);
			//设置垂直居中
			wcfmt2.setVerticalAlignment(VerticalAlignment.CENTRE);
			wcfmt2.setWrap(true);
			
			//设置列宽
			sheet.setColumnView(0, 6);
			sheet.setColumnView(1, 12);
			sheet.setColumnView(2, 12);
			//sheet.setColumnView(3, 12);
			//sheet.setColumnView(4, 12);
			sheet.setColumnView(3, 12);
			sheet.setColumnView(4, 12);
			sheet.setColumnView(15, 5);
			//sheet.setColumnView(24, 5);
			sheet.setColumnView(20, 6);
			sheet.setColumnView(22, 6);
			sheet.setColumnView(24, 12);
			sheet.setColumnView(25, 5);
			sheet.setColumnView(26, 5);
			sheet.setColumnView(32, 7);
			sheet.setColumnView(27, 12);
			sheet.setColumnView(28, 20);
			sheet.setColumnView(32, 20);
			sheet.setColumnView(30, 5);
			sheet.setColumnView(35, 12);
			sheet.setColumnView(36, 12);
			sheet.setColumnView(37, 12);
			sheet.setColumnView(38, 12);
			sheet.setColumnView(39, 12);
			sheet.setColumnView(40, 12);
			sheet.setColumnView(41, 12);
			sheet.setColumnView(42, 12);
			sheet.setColumnView(43, 12);
			sheet.setColumnView(44, 12);
			//设置行高

			//写入表头
			sheet.mergeCells(0, 0, columns.size()-1, 0);
			sheet.addCell(new Label(0, 0, sheetName, wcfmt));
			sheet.setRowView(0, 1000);
			
			
			//循环写入
			for(int i = 0 ; i< columns.size(); i ++ ){
				sheet.addCell(new Label (i,1,columns.get(i),wcfmt2));
			}
			sheet.setRowView(0, 1400);
			
			//写入数据(有数据时)
			if(reportList != null && reportList.size() != 0){
				
				for(int i = 0 ; i<reportList.size(); i++){
					//获取复筛报告
					Map<String,Object> report = reportList.get(i);
					//序号
					sheet.addCell(new Label(0 , i + 2 , "" + (i + 1), wcfmt1));
					//复筛日期
					String createTime = ""+ report.get("createTime");
					if(StringUtils.isBlank(createTime)||"null".equals(createTime)){
						createTime = "/";
					} else {
						createTime = createTime.substring(0, 10);
					}
					sheet.addCell(new Label(1 , i + 2 ,createTime,wcfmt1));
					
					//检查单位
					String hospital = ""+ report.get("hospital");
					if(StringUtils.isBlank(hospital)||"null".equals(hospital)){
						hospital = "/";
					} 
					sheet.addCell(new Label(2 , i + 2 ,hospital,wcfmt1));
					
					//出生证号
//					String birthNum = ""+ report.get("birthNum");
//					if(StringUtils.isBlank(birthNum)||"null".equals(birthNum)){
//						birthNum = "/";
//					} 
//					sheet.addCell(new Label(3 , i + 2 ,birthNum,wcfmt1));
					
					//身份证号
//					String sfzNum = ""+ report.get("sfzNum");
//					if(StringUtils.isBlank(sfzNum)||"null".equals(sfzNum)){
//						sfzNum = "/";
//					}
//					sheet.addCell(new Label(4 , i + 2 ,sfzNum,wcfmt1));
					
					//姓名
					String patientName = "" + report.get("patientName");
					if(StringUtils.isBlank(patientName)||"null".equals(patientName)) {
						patientName = "/";
					}
					sheet.addCell(new Label(3,i+2,patientName,wcfmt1));
					//性别
					String sex = "" + report.get("sex");
					if(StringUtils.isBlank(sex)||"null".equals(sex)){
						sex = "/";
					} else {
						if("0".equals(sex)){
							sex = "男";
						} else if ("1".equals(sex)){
							sex = "女";
						} else{
							sex = "/";
						}
					}
					sheet.addCell(new Label(4 ,i + 2 ,sex , wcfmt1));
					//年龄
//					String ageMonth = "" + report.get("ageMonth");
					String ageMonth = "" + report.get("firstAge");
					if(StringUtils.isBlank(ageMonth)||"null".equals(ageMonth)){
						ageMonth = "/";
					}
					sheet.addCell(new Label(5 , i+2 , ageMonth , wcfmt1));
					//户籍
					String register = "" + report.get("register");
					if(StringUtils.isBlank(register)||"null".equals(register)){
						register = "/";
					}
					sheet.addCell(new Label(6 , i+ 2 ,register , wcfmt1));
					//血管瘤或胎记个数
					String xmNum = "" + report.get("xmNum");
					if(StringUtils.isBlank(xmNum)||"null".equals(xmNum)){
						xmNum = "/";
					} else {
						if("0".equals(xmNum)){
							xmNum = "单个";
						} else if ("1".equals(xmNum)){
							xmNum = "多个";
						} else {
							xmNum = "/";
						}
					}
					sheet.addCell(new Label(7 , i+2, xmNum , wcfmt1));
					//血管瘤或胎记增长速度
					String xmGrow = "" + report.get("xmGrow");
					if(StringUtils.isBlank(xmGrow)||"null".equals(xmGrow)){
						xmGrow = "/";
					} else {
						if("0".equals(xmGrow)){
							xmGrow = "快速";
						} else if("1".equals(xmGrow)){
							xmGrow = "缓慢";
						} else if("2".equals(xmGrow)){
							xmGrow = "无变化";
						} else {
							xmGrow = "/";
						}
					}
					sheet.addCell(new Label(8,i+2,xmGrow,wcfmt1));
					
					//血管瘤或胎记发病部位
					String xmPart = "" + report.get("xmPart");
					String xmPart1 = "/";
					if(StringUtils.isBlank(xmPart)||"null".equals(xmPart)||"0000".equals(xmPart)){
						xmPart1  = "/";
					} else {

						if("1".equals("" + xmPart.charAt(0))){
							xmPart1 = xmPart1 + "头颈部   ";
						}
						if("1".equals("" + xmPart.charAt(1))){
							xmPart1 = xmPart1 + "四肢   ";
						}
						if("1".equals("" + xmPart.charAt(2))){
							xmPart1 = xmPart1 + "躯干   ";
						}
						if("1".equals("" + xmPart.charAt(3))){
							xmPart1 = xmPart1 + "内脏   ";
						}
					}
					sheet.addCell(new Label(9, i+2 , xmPart1 , wcfmt1));
					
					//B超显示低回声有无
					String Becho = "" + report.get("Becho");
					if(StringUtils.isBlank(Becho)||"null".equals(Becho)){
						Becho = "/";
					} else {
						if("0".equals(Becho)){
							Becho = "否";
						} else if ("1".equals(Becho)){
							Becho = "是";
						} else {
							Becho = "/";
						}
					}
					sheet.addCell(new Label(10 , i+2, Becho , wcfmt1));
					
					//B超显示明显血流血流信号有无
					String Bblood = "" + report.get("Bblood");
					if(StringUtils.isBlank(Bblood)||"null".equals(Bblood)){
						Bblood = "/";
					} else {
						if("0".equals(Bblood)){
							Bblood = "否";
						} else if ("1".equals(Bblood)){
							Bblood = "是";
						} else {
							Bblood = "/";
						}
					}
					sheet.addCell(new Label(11 , i+2, Bblood , wcfmt1));
					
					//内脏血管瘤B超有无
					String Borgan = "" + report.get("Borgan");
					if(StringUtils.isBlank(Borgan)||"null".equals(Borgan)){
						Borgan = "/";
					} else {
						if("0".equals(Borgan)){
							Borgan = "否";
						} else if ("1".equals(Borgan)){
							Borgan = "是";
						} else {
							Borgan = "/";
						}
					}
					sheet.addCell(new Label(12 , i+2, Borgan , wcfmt1));
					
					//血管瘤或胎记大小
					String xmShape = "" + report.get("xmShape");
					String xmSize = "" + report.get("xmSize");
					
					if(StringUtils.isNotBlank(xmShape)&&!xmShape.equals("null")){
						if("0".equals(xmShape)){
							xmShape = "小红点";
						}else if("1".equals(xmShape)){
							xmShape = "绿豆大小";
						}else if("2".equals(xmShape)){
							xmShape = "硬币大小";
						}else if("3".equals(xmShape)){
							xmShape = "鸡蛋大小";
						}
						sheet.addCell(new Label(13 ,i+2 , xmShape , wcfmt1));
					}else if(StringUtils.isNotBlank(xmSize)&&!xmSize.equals("null")){
						
						if("0".equals(xmSize)){
							xmSize = "<1cm";
						}else if("1".equals(xmSize)){
							xmSize = ">1cm";
						}else if("2".equals(xmSize)){
							xmSize = ">3cm";
						}else if("3".equals(xmSize)){
							xmSize = ">5cm";
						}else if("4".equals(xmSize)){
							xmSize = ">10cm";
						}
						sheet.addCell(new Label(13 ,i+2 , xmSize , wcfmt1));	
					}
					
					//血管瘤或胎记肤色
					String xmColor = "" + report.get("xmColor");
					String xmColor1 = "/";
					if(StringUtils.isBlank(xmColor)||"null".equals(xmColor)){
						xmColor1  = "/";
					} else {

						if("1".equals("" + xmColor.charAt(0))){
							xmColor1 = xmColor1 + "肤色   ";
						}
						if("1".equals("" + xmColor.charAt(1))){
							xmColor1 = xmColor1 + "红色   ";
						}
						if("1".equals("" + xmColor.charAt(2))){
							xmColor1 = xmColor1 + "暗紫红色   ";
						}
						if("1".equals("" + xmColor.charAt(3))){
							xmColor1 = xmColor1 + "蓝色   ";
						}
						if("1".equals("" + xmColor.charAt(4))){
							xmColor1 = xmColor1 + "青色   ";
						}
						if("1".equals("" + xmColor.charAt(5))){
							xmColor1 = xmColor1 + "黑色   ";
						}
						if("1".equals("" + xmColor.charAt(6))){
							xmColor1 = xmColor1 + "褐色   ";
						}
						if("1".equals("" + xmColor.charAt(7))){
							xmColor1 = xmColor1 + "粉红色   ";
						}
						if("1".equals("" + xmColor.charAt(8))){
							xmColor1 = xmColor1 + "浅红色   ";
						}	
					}
					sheet.addCell(new Label(14, i+2 , xmColor1 , wcfmt1));
					
					
					//是否消退
					String xmFall = "" + report.get("xmFall");
					if(StringUtils.isBlank(xmFall)||"null".equals(xmFall)){
						xmFall = "/";
					} else {
						if("0".equals(xmFall)){
							xmFall = "否";
						} else if ("1".equals(xmFall)){
							xmFall = "是";
						} else {
							xmFall = "/";
						}
					}
					sheet.addCell(new Label(15 , i+2, xmFall , wcfmt1));
					
					//皮肤局部有无突起
					String skinRaised = "" + report.get("skinRaised");
					if(StringUtils.isBlank(skinRaised)||"null".equals(skinRaised)){
						skinRaised = "/";
					} else {
						if("0".equals(skinRaised)){
							skinRaised = "否";
						} else if ("1".equals(skinRaised)){
							skinRaised = "是";
						} else {
							skinRaised = "/";
						}
					}
					sheet.addCell(new Label(16 , i+2, skinRaised , wcfmt1));
					
					//家族血亲三代史
					String jzsxm = "" + report.get("jzsxm");
					if(StringUtils.isBlank(jzsxm)||"null".equals(jzsxm)){
						jzsxm = "/";
					} else {
						if("0".equals(jzsxm)){
							jzsxm = "否";
						} else if ("1".equals(jzsxm)){
							jzsxm = "是";
						} else {
							jzsxm = "/";
						}
					}
					sheet.addCell(new Label(17 , i+2, jzsxm , wcfmt1));

					//父母兄弟姐妹史
					String xdjmxm = "" + report.get("xdjmxm");
					if(StringUtils.isBlank(xdjmxm)||"null".equals(xdjmxm)){
						xdjmxm = "/";
					} else {
						if("0".equals(xdjmxm)){
							xdjmxm = "否";
						} else if ("1".equals(xdjmxm)){
							xdjmxm = "是";
						} else {
							xdjmxm = "/";
						}
					}
					sheet.addCell(new Label(18 , i+2, xdjmxm , wcfmt1));
					
					//母孕产史
					String yunChan = "" + report.get("yunChan");
					if(StringUtils.isBlank(yunChan)||"null".equals(yunChan)){
						yunChan = "/";
					} else {
						if("0".equals(yunChan)){
							yunChan = "否";
						} else if ("1".equals(yunChan)){
							yunChan = "是";
						} else {
							yunChan = "/";
						}
					}
					sheet.addCell(new Label(19 , i+2, yunChan , wcfmt1));
					
					//此孩怀孕年龄
					String yunAge = "" + report.get("yunAge");
					if(StringUtils.isBlank(yunAge)||"null".equals(yunAge)){
						yunAge = "/";
					}
					sheet.addCell(new Label(20, i+2 ,yunAge , wcfmt1));
					
					//孕期药物治疗史
					String drugHistory = "" + report.get("drugHistory");
					String drugHistory1 = "";
					if(StringUtils.isBlank(drugHistory)||"null".equals(drugHistory)
							||"0000".equals(drugHistory)){
						drugHistory1  = "/";
					} else {

						if("1".equals("" + drugHistory.charAt(0))){
							drugHistory1 = drugHistory1 + "黄体酮   ";
						}
						if("1".equals("" + drugHistory.charAt(1))){
							drugHistory1 = drugHistory1 + "雌激素   ";
						}
						if("1".equals("" + drugHistory.charAt(2))){
							drugHistory1 = drugHistory1 + "氯米芬   ";
						}
						if("1".equals("" + drugHistory.charAt(3))){
							drugHistory1 = drugHistory1 + "克罗米芬   ";
						}
					
					}
					sheet.addCell(new Label(21, i+2 , drugHistory1 , wcfmt1));
					//孕期有家庭装修史
					String yunFitment = "" + report.get("yunFitment");
					if(StringUtils.isBlank(yunFitment)||"null".equals(yunFitment)){
						yunFitment = "/";
					} else {
						if("0".equals(yunFitment)){
							yunFitment = "否";
						} else if ("1".equals(yunFitment)){
							yunFitment = "是";
						} else {
							yunFitment = "/";
						}
					}
					sheet.addCell(new Label(22 , i+2, yunFitment , wcfmt1));
					
					//母亲有无视频显示终端暴露
					String VDTs = "" + report.get("VDTs");
					if(StringUtils.isBlank(VDTs)||"null".equals(VDTs)){
						VDTs = "/";
					} else {
						if("0".equals(VDTs)){
							VDTs = "否";
						} else if ("1".equals(VDTs)){
							VDTs = "是";
						} else {
							VDTs = "/";
						}
					}
					sheet.addCell(new Label(23 , i+2, VDTs , wcfmt1));
					
					//母亲饮用水（自来水、井水、河水）
					String mumDrink = "" + report.get("mumDrink");
					String mumDrink1 = "";
					if(StringUtils.isBlank(mumDrink)||"null".equals(mumDrink)
							||"000".equals(mumDrink)){
						mumDrink1  = "/";
					} else {

						if("1".equals("" + mumDrink.charAt(0))){
							mumDrink1 = mumDrink1 + "自来水   ";
						}
						if("1".equals("" + mumDrink.charAt(1))){
							mumDrink1 = mumDrink1 + "井水   ";
						}
						if("1".equals("" + mumDrink.charAt(2))){
							mumDrink1 = mumDrink1 + "河水   ";
						}
					}
					sheet.addCell(new Label(24, i+2 , mumDrink1 , wcfmt1));
					
					//羊膜检测
					String amnioscopy = "" + report.get("amnioscopy");
					if(StringUtils.isBlank(amnioscopy)||"null".equals(amnioscopy)){
						amnioscopy = "/";
					} else {
						if("0".equals(amnioscopy)){
							amnioscopy = "否";
						} else if ("1".equals(amnioscopy)){
							amnioscopy = "是";
						} else {
							amnioscopy = "/";
						}
					}
					sheet.addCell(new Label(25 , i+2, amnioscopy , wcfmt1));
					
					//羊膜囊穿刺
					String amniocentesis = "" + report.get("amniocentesis");
					if(StringUtils.isBlank(amniocentesis)||"null".equals(amniocentesis)){
						amniocentesis = "/";
					} else {
						if("0".equals(amniocentesis)){
							amniocentesis = "否";
						} else if ("1".equals(amniocentesis)){
							amniocentesis = "是";
						} else {
							amniocentesis = "/";
						}
					}
					sheet.addCell(new Label(26 , i+2, amniocentesis , wcfmt1));
					
					//母亲孕期有无外伤史或腹部撞击史
					String hurted = "" + report.get("hurted");
					if(StringUtils.isBlank(hurted)||"null".equals(hurted)){
						hurted = "/";
					} else {
						if("0".equals(hurted)){
							hurted = "否";
						} else if ("1".equals(hurted)){
							hurted = "是";
						} else {
							hurted = "/";
						}
					}
					sheet.addCell(new Label(27 , i+2, hurted , wcfmt1));

					//血管瘤治疗情况
					String cureDrug = "" + report.get("cureDrug");
					String cureOther = "" + report.get("cureOther");
					if(StringUtils.isBlank(cureDrug)||"null".equals(cureDrug)){
						cureDrug = "/";
					}
					if(StringUtils.isBlank(cureOther)||"null".equals(cureOther)){
						cureOther = "/";
					}
					sheet.addCell(new Label(28, i+2,
							"口服药物：" + cureDrug + ";其他治疗：" + cureOther , wcfmt1));
					
					//孕期伴随情况
					String yunCase = "" + report.get("yunCase");
					String yunCase1 = "/";
					if(StringUtils.isBlank(yunCase)||"null".equals(yunCase)){
						yunCase1  = "/";
					} else {

						if("1".equals("" + yunCase.charAt(0))){
							yunCase1 = yunCase1 + "多胎妊娠   ";
						}
						if("1".equals("" + yunCase.charAt(1))){
							yunCase1 = yunCase1 + "单卵   ";
						}
						if("1".equals("" + yunCase.charAt(2))){
							yunCase1 = yunCase1 + "双卵   ";
						}
						if("1".equals("" + yunCase.charAt(3))){
							yunCase1 = yunCase1 + "先兆子痫   ";
						}
						if("1".equals("" + yunCase.charAt(4))){
							yunCase1 = yunCase1 + "前置胎盘   ";
						}
						if("1".equals("" + yunCase.charAt(5))){
							yunCase1 = yunCase1 + "早产   ";
						}
						if("1".equals("" + yunCase.charAt(6))){
							yunCase1 = yunCase1 + "先兆流产   ";
						}
						if("1".equals("" + yunCase.charAt(7))){
							yunCase1 = yunCase1 + "妊娠高血压   ";
						}
						if("1".equals("" + yunCase.charAt(8))){
							yunCase1 = yunCase1 + "胎位不正   ";
						}
						if("1".equals("" + yunCase.charAt(9))){
							yunCase1 = yunCase1 + "糖尿病   ";
						}
						if("1".equals("" + yunCase.charAt(10))){
							yunCase1 = yunCase1 + "病毒性肝炎   ";
						}
					}
					sheet.addCell(new Label(29, i+2 , yunCase1 , wcfmt1));
					
					//是否早产儿
					String isPremature = "";
					if(StringUtils.isBlank(yunCase)||"null".equals(yunCase)){
						isPremature  = "/";
					} else {
						if("1".equals(""+ yunCase.charAt(5))){
							isPremature = "是";
						} else if ("0".equals(""+ yunCase.charAt(5))){
							isPremature = "否";
						} else {
							isPremature  = "/";
						}
					}
					sheet.addCell(new Label(30, i+2 , isPremature ,wcfmt1));
					
					//患儿出生地
					String birthPlace = "" + report.get("birthPlace");
					if(StringUtils.isBlank(birthPlace)||"null".equals(birthPlace)){
						birthPlace = "/";
					}
					sheet.addCell(new Label(31, i+2 ,birthPlace,wcfmt1));
					
					//出生体重
					String birthWeight = "" + report.get("birthWeight");
					if(StringUtils.isBlank(birthWeight)||"null".equals(birthWeight)){
						birthWeight = "/";
					}
					sheet.addCell(new Label(32, i+2 ,birthWeight,wcfmt1));
					
					//血管瘤并发疾病及血管瘤合并疾病
					String xmCase = "" + report.get("xmCase");
					String xmCase1 = "/";
					if(StringUtils.isBlank(xmCase)||"null".equals(xmCase)){
						xmCase1  = "/";
					} else {

						if("1".equals("" + xmCase.charAt(0))){
							xmCase1 = xmCase1 + "溃疡   ";
						}
						if("1".equals("" + xmCase.charAt(1))){
							xmCase1 = xmCase1 + "出血   ";
						}
						if("1".equals("" + xmCase.charAt(2))){
							xmCase1 = xmCase1 + "睡眠打鼾  ";
						}
						if("1".equals("" + xmCase.charAt(3))){
							xmCase1 = xmCase1 + "呼吸困难   ";
						}
						if("1".equals("" + xmCase.charAt(4))){
							xmCase1 = xmCase1 + "吞咽障碍   ";
						}
						if("1".equals("" + xmCase.charAt(5))){
							xmCase1 = xmCase1 + "眼部疾病影响视力   ";
						}
						if("1".equals("" + xmCase.charAt(6))){
							xmCase1 = xmCase1 + "心衰   ";
						}
						if("1".equals("" + xmCase.charAt(7))){
							xmCase1 = xmCase1 + "脑部病变   ";
						}
						if("1".equals("" + xmCase.charAt(8))){
							xmCase1 = xmCase1 + "其他   ";
						}
						if("1".equals("" + xmCase.charAt(9))){
							xmCase1 = xmCase1 + "暂无   ";
						}
							
					}
					sheet.addCell(new Label(33, i+2 , xmCase1 , wcfmt1));
					
					//血常规（PLT/VEGF）
					String VEGF = "" + report.get("VEGF");
					if(StringUtils.isBlank(VEGF)||"null".equals(VEGF)){
						VEGF = "/";
					}
					sheet.addCell(new Label(34, i+ 2 ,VEGF,wcfmt1));
					
					//初步诊断
					String Pdiagnose = "" + report.get("Pdiagnose");
					if(StringUtils.isBlank(Pdiagnose)||"null".equals(Pdiagnose)){
						Pdiagnose = "/";
					} else {
						if("0".equals(Pdiagnose)){
							Pdiagnose = "真性血管瘤";
						} else if ("1".equals(Pdiagnose)){
							Pdiagnose = "血管畸形";
						} else if ("2".equals(Pdiagnose)){
							Pdiagnose = "淋巴畸形";
						} else if ("3".equals(Pdiagnose)){
							Pdiagnose = "脉管畸形";
						} else if ("4".equals(Pdiagnose)){
							Pdiagnose = "其他色素痣";
						} else {
							Pdiagnose = "/";
						}
					}
					sheet.addCell(new Label(35 , i+2, Pdiagnose , wcfmt1));
					
					//血管瘤类型
					
					String xmType = "" + report.get("xmType");
					if(StringUtils.isBlank(xmType)||"null".equals(xmType)){
						xmType = "/";
					} else {
						if("0".equals(xmType)){
							xmType = "表浅型";
						} else if ("1".equals(xmType)){
							xmType = "深部型";
						} else if ("2".equals(xmType)){
							xmType = "深浅混合型";
						} else {
							xmType = "/";
						}
					}
					sheet.addCell(new Label(36 , i+2, xmType , wcfmt1));
					//皮肤病变处特质
					String disease = "" + report.get("disease");
					if(StringUtils.isBlank(disease) || disease.equals("null")){
						disease = "/";
					}else{
						if("0".equals(disease)){
							disease = "柔软";
						}else if("1".equals(disease)){
							disease = "较硬";
						}else {
							disease = "/";
						}
					}
					sheet.addCell(new Label(37 , i+2 , disease ,wcfmt1));
					
					// 是否人工助孕
					String rgYun = "" + report.get("rgYun");
					if(StringUtils.isBlank(rgYun)||"null".equals(rgYun)){
						rgYun = "否";
					} else {
						if ("1".equals(rgYun)) {
							rgYun = "是";
						} else if ("0".equals(rgYun)) {
							rgYun = "否";
						} else {
							rgYun = "/";
						}
					}
					sheet.addCell(new Label(38 , i+2, rgYun , wcfmt1));
					
					// 母亲姓名
					String mum = "" + report.get("motherName");
					if(StringUtils.isBlank(mum)||mum.equals("null")){
						mum = " / ";
					}
					sheet.addCell(new Label(39 , i+2, mum , wcfmt1));
					
					// 母亲民族
					String mumNation = "" + report.get("mumNation");
					if(StringUtils.isBlank(mumNation)||mumNation.equals("null")){
						mumNation = " / ";
					}
					sheet.addCell(new Label(40 , i+2, mumNation , wcfmt1));
					
					// 母亲学历
					String mumEducation = "" + report.get("mumEducation");
					if(StringUtils.isBlank(mumEducation)||mumEducation.equals("null")){
						mumEducation = " / ";
					}
					sheet.addCell(new Label(41 , i+2, mumEducation , wcfmt1));
					
					// 母亲联系电话
					String mumTel = "" + report.get("motherPhone");
					if(StringUtils.isBlank(mumTel)||mumTel.equals("null")){
						mumTel = " / ";
					}
					sheet.addCell(new Label(42 , i+2, mumTel , wcfmt1));
					
					// 父亲姓名
					String dad = "" + report.get("fatherName");
					if(StringUtils.isBlank(dad)||dad.equals("null")){
						dad = " / ";
					}
					sheet.addCell(new Label(43 , i+2, dad , wcfmt1));
					
					// 父亲民族
					String dadNation = "" + report.get("dadNation");
					if(StringUtils.isBlank(dadNation)||dadNation.equals("null")){
						dadNation = " / ";
					}
					sheet.addCell(new Label(44 , i+2, dadNation , wcfmt1));
					
					// 父亲学历
					String dadEducation = "" + report.get("dadEducation");
					if(StringUtils.isBlank(dadEducation)||dadEducation.equals("null")){
						dadEducation = " / ";
					}
					sheet.addCell(new Label(45 , i+2, dadEducation , wcfmt1));
					
					// 父亲联系电话
					String dadTel = "" + report.get("fatherPhone");
					if(StringUtils.isBlank(dadTel)||dadTel.equals("null")){
						dadTel = " / ";
					}
					sheet.addCell(new Label(46 , i+2, mumTel , wcfmt1));
				}

			}
			
			workbook.write();
			
		}finally{
			workbook.close();
			os.flush();
			os.close();
		}
		
	}


    public static void rosterDown(HttpServletResponse response, HuaLongRosterVo huaLongRosterVo, String titleName, String sheetName, List<String> columns) {

		OutputStream os = null;
		WritableWorkbook workbook = null;

		try{

			os = response.getOutputStream();
			workbook = Workbook.createWorkbook(os);

			WritableSheet sheet = workbook.createSheet(sheetName, 0);

			//创建画笔
			//第一种画笔
			WritableFont wft = new WritableFont(WritableFont.ARIAL,20,WritableFont.BOLD,false,UnderlineStyle.NO_UNDERLINE,Colour.BLACK);
			WritableCellFormat wcfmt = new WritableCellFormat(wft);
			wcfmt.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
			//设置水平居中
			wcfmt.setAlignment(Alignment.CENTRE);
			//设置垂直居中
			wcfmt.setVerticalAlignment(VerticalAlignment.CENTRE);
			wcfmt.setWrap(true);

			//第二种画笔
			WritableFont wft1 = new WritableFont(WritableFont.ARIAL,10,WritableFont.NO_BOLD,false,UnderlineStyle.NO_UNDERLINE,Colour.BLACK);
			WritableCellFormat wcfmt1 = new WritableCellFormat(wft1);
			wcfmt1.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
			wcfmt1.setAlignment(Alignment.CENTRE);
			//设置垂直居中
			wcfmt1.setVerticalAlignment(VerticalAlignment.CENTRE);
			wcfmt1.setWrap(true);

			// 强休
			WritableFont wft4 = new WritableFont(WritableFont.ARIAL,10,WritableFont.NO_BOLD,false,UnderlineStyle.NO_UNDERLINE,Colour.BLACK);
			WritableCellFormat wcfmt4 = new WritableCellFormat(wft4);
			wcfmt4.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
			wcfmt4.setBackground(Colour.getInternalColour(23)); // 50% 灰色
			wcfmt4.setAlignment(Alignment.CENTRE);
			//设置垂直居中
			wcfmt4.setVerticalAlignment(VerticalAlignment.CENTRE);
			wcfmt4.setWrap(true);

			//第三种画笔
			WritableFont wft2 = new WritableFont(WritableFont.ARIAL,12,WritableFont.BOLD,false,UnderlineStyle.NO_UNDERLINE,Colour.BLACK);
			WritableCellFormat wcfmt2 = new WritableCellFormat(wft2);
			wcfmt2.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
			//设置水平居中
			wcfmt2.setAlignment(Alignment.CENTRE);
			//设置垂直居中
			wcfmt2.setVerticalAlignment(VerticalAlignment.CENTRE);
			wcfmt2.setWrap(true);

			// 第一行
			sheet.mergeCells(0, 0, columns.size() - 1, 0);
			sheet.addCell(new Label(0, 0, titleName, wcfmt));
			sheet.setRowView(0, 1000);

			// 第二行
			String[] years = huaLongRosterVo.getMonth().split("-");
			String month = String.format("%s年%s月份", years[0], years[1]);
			sheet.mergeCells(0, 1, columns.size() - 15, 1);
			sheet.addCell(new Label(0, 1, month, wcfmt));

			String buildName = String.format("(%s)", huaLongRosterVo.getTeamBuildName());
			sheet.mergeCells(columns.size() - 14, 1, columns.size() - 1, 1);
			sheet.addCell(new Label(columns.size() - 14, 1, buildName, wcfmt));
			sheet.setRowView(1, 700);

			// 第三行
			for(int i = 0; i < columns.size(); i++ ) {
				sheet.addCell(new Label (i,2, columns.get(i), wcfmt2));
			}
			sheet.setRowView(2, 450);

			List<String> weeks = Lists.newArrayList();
			weeks.add("姓名");

			for (int i = 0; i < huaLongRosterVo.getHuaLongRosterItemDtoList().size(); i++) {
				HuaLongRosterItemDto hlri = huaLongRosterVo.getHuaLongRosterItemDtoList().get(i);

				for (int j = 0; j < hlri.getHuaLongRosterShiftDtoList().size(); j++) {
					HuaLongRosterShiftDto hlrs = hlri.getHuaLongRosterShiftDtoList().get(j);
					if (i == 0) {
						weeks.add(hlrs.getWeek());
					}

					sheet.addCell(new Label(0,i + 4, hlri.getNurseName(), wcfmt1));
					if (hlrs.getIsStrong().equals(1)) {
						sheet.addCell(new Label(Integer.parseInt(hlrs.getDay()), i + 4, hlrs.getShift(), wcfmt4));
					} else {
						sheet.addCell(new Label(Integer.parseInt(hlrs.getDay()), i + 4, hlrs.getShift(), wcfmt1));
					}

				}
			}

			// 第四行
			for(int i = 0; i < weeks.size(); i++ ) {

				sheet.addCell(new Label (i,3, weeks.get(i), wcfmt2));
			}
			sheet.setRowView(3, 450);

			// 写入Excel工作表
			workbook.write();

			//关闭Excel工作薄对象
			workbook.close();

			//关闭流
			os.flush();
			os.close();

			os = null;

		} catch (Exception e){
			e.printStackTrace();
		}
	}

	/**
	 * 个人卫生记录导出
	 *
	 * @param response
	 * @param huaLongSanitationVoList
	 * @param titleName
	 * @param sheetName
	 * @param omcSanitationServiceList
	 * @param month
	 */
	public static void sanitationDown(HttpServletResponse response,
									  List<HuaLongSanitationVo> huaLongSanitationVoList,
									  String titleName, String sheetName,
									  List<OmcSanitationService> omcSanitationServiceList,
									  String month) {

		OutputStream os = null;
		WritableWorkbook workbook = null;

		try{

			os = response.getOutputStream();
			workbook = Workbook.createWorkbook(os);

			WritableSheet sheet = workbook.createSheet(sheetName, 0);

			//创建画笔
			//第一种画笔
			WritableFont wft = new WritableFont(WritableFont.ARIAL,20,WritableFont.BOLD,false,UnderlineStyle.NO_UNDERLINE,Colour.BLACK);
			WritableCellFormat wcfmt = new WritableCellFormat(wft);
			wcfmt.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
			//设置水平居中
			wcfmt.setAlignment(Alignment.CENTRE);
			//设置垂直居中
			wcfmt.setVerticalAlignment(VerticalAlignment.CENTRE);
			wcfmt.setWrap(true);

			//第二种画笔
			WritableFont wft1 = new WritableFont(WritableFont.ARIAL,10,WritableFont.NO_BOLD,false,UnderlineStyle.NO_UNDERLINE,Colour.BLACK);
			WritableCellFormat wcfmt1 = new WritableCellFormat(wft1);
			wcfmt1.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
			wcfmt1.setAlignment(Alignment.CENTRE);
			//设置垂直居中
			wcfmt1.setVerticalAlignment(VerticalAlignment.CENTRE);
			wcfmt1.setWrap(true);

			//第三种画笔
			WritableFont wft2 = new WritableFont(WritableFont.ARIAL,12,WritableFont.BOLD,false,UnderlineStyle.NO_UNDERLINE,Colour.BLACK);
			WritableCellFormat wcfmt2 = new WritableCellFormat(wft2);
			wcfmt2.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
			//设置水平居中
			wcfmt2.setAlignment(Alignment.CENTRE);
			//设置垂直居中
			wcfmt2.setVerticalAlignment(VerticalAlignment.CENTRE);
			wcfmt2.setWrap(true);

			// 第一行
			sheet.mergeCells(0, 0, omcSanitationServiceList.size() + 1, 0);
			sheet.addCell(new Label(0, 0, titleName, wcfmt));
			sheet.setRowView(0, 1000);

			// 第二行
			// 姓名
			String nurseName = String.format("姓名: %s", huaLongSanitationVoList.get(0).getOldManName());
			// 性别
			String sex = String.format("性别: %s", huaLongSanitationVoList.get(0).getOldManGender() == 1 ? "男" : "女");
			// 年龄
			String age = String.format("年龄: %s", huaLongSanitationVoList.get(0).getOldManAge());
			// 房间
			String room  = String.format("房间: %s", huaLongSanitationVoList.get(0).getRoomNo());
			// 床号
			String bed  = String.format("床号: %s", huaLongSanitationVoList.get(0).getBedNo());
			// 照护等级
			String careLevel  = String.format("照护等级: %s", huaLongSanitationVoList.get(0).getOldManLevelCare());
			// 年月
			String[] years = month.split("-");
			String titleMonth = String.format("%s年%s月", years[0], years[1]);

			String str = String.format("  %s    %s    %s    %s    %s", nurseName, sex, age, room, bed, careLevel, titleMonth);
			sheet.mergeCells(0, 1, omcSanitationServiceList.size() + 1, 1);
			sheet.addCell(new Label(0, 1, str, wcfmt2));
			sheet.setRowView(1, 450);

			// 第三行
			// 表头（卫生项）list 转 map
			Map<Long, Integer> col = Maps.newHashMap();
			for(int i = 0; i <= omcSanitationServiceList.size(); i++ ) {
				if (i == 0) {
					sheet.addCell(new Label (i,2, "日期", wcfmt2));
				} else {
					sheet.addCell(new Label (i,2, omcSanitationServiceList.get(i - 1).getServiceName(), wcfmt2));
					col.put(omcSanitationServiceList.get(i - 1).getId(), i);
				}
			}
			sheet.addCell(new Label (omcSanitationServiceList.size() + 1,2, "签名", wcfmt2));
			sheet.setRowView(2, 450);

			int day = DateUtil.getDayOfMonth(month);
			for (int k = 1; k <= day; k++) {
				for (int m = 0; m <= omcSanitationServiceList.size() + 1; m++) {
					if (m == 0) {
						sheet.addCell(new Label(m, k + 2, k + "", wcfmt2));
					} else {
						sheet.addCell(new Label(m, k + 2, "", wcfmt2));
					}
				}
			}

			for (HuaLongSanitationVo hlsv : huaLongSanitationVoList) {
				int sec = DateUtil.getSec(hlsv.getRecordDate());
				for (HuaLongSanitationItemVo hlsi : hlsv.getHuaLongSanitationItemVoList()) {
					Integer c = col.get(hlsi.getServiceId()); // (char)8730 + ""
					if (PublicUtil.isEmpty(c)) {
						continue;
					}
					sheet.addCell(new Label(c, sec + 2, "√", wcfmt1));	// √
				}
				sheet.addCell(new Label(omcSanitationServiceList.size() + 1, sec + 2, hlsv.getNursingName(), wcfmt1));
			}

			// 写入Excel工作表
			workbook.write();

			//关闭Excel工作薄对象
			workbook.close();

			//关闭流
			os.flush();
			os.close();

			os = null;

		} catch (Exception e){
			e.printStackTrace();
		}

	}

	/**
	 * 日常用品消毒记录表
	 *
	 * @param response
	 * @param huaLongEveryDsftRecordVoList
	 * @param titleName
	 * @param sheetName
	 * @param huaLongEveryDsftMethodVoList
	 * @param month
	 */
	public static void everyDsftDown(HttpServletResponse response,
									 List<HuaLongEveryDsftRecordVo> huaLongEveryDsftRecordVoList,
									 String titleName, String sheetName,
									 List<HuaLongEveryDsftMethodVo> huaLongEveryDsftMethodVoList,
									 String month,
									 String buildingNo) {

		OutputStream os = null;
		WritableWorkbook workbook = null;

		try{

			os = response.getOutputStream();
			workbook = Workbook.createWorkbook(os);

			WritableSheet sheet = workbook.createSheet(sheetName, 0);

			//创建画笔
			//第一种画笔
			WritableFont wft = new WritableFont(WritableFont.ARIAL,20,WritableFont.BOLD,false,UnderlineStyle.NO_UNDERLINE,Colour.BLACK);
			WritableCellFormat wcfmt = new WritableCellFormat(wft);
			wcfmt.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
			//设置水平居中
			wcfmt.setAlignment(Alignment.CENTRE);
			//设置垂直居中
			wcfmt.setVerticalAlignment(VerticalAlignment.CENTRE);
			wcfmt.setWrap(true);

			//第二种画笔
			WritableFont wft1 = new WritableFont(WritableFont.ARIAL,10,WritableFont.NO_BOLD,false,UnderlineStyle.NO_UNDERLINE,Colour.BLACK);
			WritableCellFormat wcfmt1 = new WritableCellFormat(wft1);
			wcfmt1.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
			wcfmt1.setAlignment(Alignment.CENTRE);
			//设置垂直居中
			wcfmt1.setVerticalAlignment(VerticalAlignment.CENTRE);
			wcfmt1.setWrap(true);

			//第三种画笔
			WritableFont wft2 = new WritableFont(WritableFont.ARIAL,12,WritableFont.BOLD,false,UnderlineStyle.NO_UNDERLINE,Colour.BLACK);
			WritableCellFormat wcfmt2 = new WritableCellFormat(wft2);
			wcfmt2.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
			//设置水平居中
			wcfmt2.setAlignment(Alignment.CENTRE);
			//设置垂直居中
			wcfmt2.setVerticalAlignment(VerticalAlignment.CENTRE);
			wcfmt2.setWrap(true);

			// 列数 （日期(1) + 消毒位置(数量) + 签名(1)）
			int cols = 1;
			// 消毒位置坐标map (id, index)
			Map<Long, Integer> colsMap = Maps.newHashMap();

			/******************* 处理表头 *******************/
			// 表头 ==> 日期 （0,2 - 0,5）
			sheet.mergeCells(0, 2, 0, 5);
			sheet.addCell(new Label(0, 2, "日期", wcfmt2));

			for (int i = 1;  i <= huaLongEveryDsftMethodVoList.size(); i++) {
				HuaLongEveryDsftMethodVo hledv = huaLongEveryDsftMethodVoList.get(i - 1);
				for (int j = 0; j < hledv.getHuaLongEveryDsftPosVoList().size(); j++) {
					HuaLongEveryDsftPosVo hledp = hledv.getHuaLongEveryDsftPosVoList().get(j);
					// 表头 ==> 消毒位置
					sheet.addCell(new Label (cols,5, hledp.getPositionName(), wcfmt2));

					colsMap.put(hledp.getPositionId(), cols);
					cols++;
				}
				// 表头 ==> 消毒方式
				int s = cols - hledv.getHuaLongEveryDsftPosVoList().size();
				int e = cols - 1;
				sheet.mergeCells(s, 2, e, 2);
				sheet.addCell(new Label(s, 2, hledv.getName(), wcfmt2));

				// 表头 ==> 消毒规格 (用法 & 用量)
				sheet.mergeCells(s, 3, e, 3);
				sheet.addCell(new Label(s, 3, hledv.getDosage(), wcfmt2));

				// 表头 ==> 消毒频次 (频次 & 时间段)
				sheet.mergeCells(s, 4, e, 4);
				sheet.addCell(new Label(s, 4, hledv.getFrequency(), wcfmt2));
			}
			sheet.setRowView(2, 450);
			sheet.setRowView(3, 450);
			sheet.setRowView(4, 450);
			sheet.setRowView(5, 450);


			// 表头 ==> 日期 （0,3 - 1,6）
			sheet.mergeCells(cols, 2, cols, 5);
			sheet.addCell(new Label(cols, 2, "签名", wcfmt2));


			// 第一行
			sheet.mergeCells(0, 0, cols, 0);
			sheet.addCell(new Label(0, 0, titleName, wcfmt));
			sheet.setRowView(0, 1000);

			// 第二行
			// 楼号
			String buildingName = String.format("楼号: %s", buildingNo);
			// 年月
			String[] years = month.split("-");
			String titleMonth = String.format("%s年%s月", years[0], years[1]);

			String str = String.format("%s        %s", buildingName, titleMonth);
			sheet.mergeCells(0, 1, cols, 1);
			sheet.addCell(new Label(0, 1, str, wcfmt2));
			sheet.setRowView(1, 450);


			/****************** 绘制表格 ******************/
			int day = DateUtil.getDayOfMonth(month);
			for (int k = 1; k <= day; k++) {
				for (int m = 0; m <= cols; m++) {
					if (m == 0) {
						sheet.addCell(new Label(m, k + 5, k + "", wcfmt2));
					} else {
						sheet.addCell(new Label(m, k + 5, "", wcfmt2));
					}
				}
			}

			/****************** 填充数据 ******************/
			for (HuaLongEveryDsftRecordVo hledr : huaLongEveryDsftRecordVoList) {
				int sec = DateUtil.getSec(hledr.getRecordDate());
				for (HuaLongEveryDsftPosVo hledp : hledr.getHuaLongEveryDsftPosVoList()) {
				    Integer c = colsMap.get(hledp.getPositionId()); // (char)8730 + ""
					if (PublicUtil.isEmpty(c)) {
					    continue;
                    }
					sheet.addCell(new Label(c, sec + 5, "√", wcfmt1));	// √
				}
				sheet.addCell(new Label(cols, sec + 5, hledr.getNursingName(), wcfmt1));
			}


			// 写入Excel工作表
			workbook.write();

			//关闭Excel工作薄对象
			workbook.close();

			//关闭流
			os.flush();
			os.close();

			os = null;

		} catch (Exception e){
			e.printStackTrace();
		}
	}

    /**
     * 便器消毒记录表导出
	 *
     *
     * @param response
     * @param huaLongToiletDsftRecordVoList
     * @param titleName
     * @param sheetName
     */
    public static void toiletDsftDown(HttpServletResponse response,
                                      List<HuaLongToiletDsftRecordVo> huaLongToiletDsftRecordVoList,
                                      String titleName,
                                      String sheetName,
                                      HuaLongToiletDownDto huaLongToiletDownDto) {

        OutputStream os = null;
        WritableWorkbook workbook = null;

        try{

            os = response.getOutputStream();
            workbook = Workbook.createWorkbook(os);

            WritableSheet sheet = workbook.createSheet(sheetName, 0);

            //创建画笔
            //第一种画笔
            WritableFont wft = new WritableFont(WritableFont.ARIAL,20,WritableFont.BOLD,false,UnderlineStyle.NO_UNDERLINE,Colour.BLACK);
            WritableCellFormat wcfmt = new WritableCellFormat(wft);
            wcfmt.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
            //设置水平居中
            wcfmt.setAlignment(Alignment.CENTRE);
            //设置垂直居中
            wcfmt.setVerticalAlignment(VerticalAlignment.CENTRE);
            wcfmt.setWrap(true);

            //第二种画笔
            WritableFont wft1 = new WritableFont(WritableFont.ARIAL,12,WritableFont.NO_BOLD,false,UnderlineStyle.NO_UNDERLINE,Colour.BLACK);
            WritableCellFormat wcfmt1 = new WritableCellFormat(wft1);
            wcfmt1.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
            wcfmt1.setAlignment(Alignment.CENTRE);
            //设置垂直居中
            wcfmt1.setVerticalAlignment(VerticalAlignment.CENTRE);
            wcfmt1.setWrap(true);

            //第三种画笔
            WritableFont wft2 = new WritableFont(WritableFont.ARIAL,12,WritableFont.BOLD,false,UnderlineStyle.NO_UNDERLINE,Colour.BLACK);
            WritableCellFormat wcfmt2 = new WritableCellFormat(wft2);
            wcfmt2.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
            //设置水平居中
            wcfmt2.setAlignment(Alignment.CENTRE);
            //设置垂直居中
            wcfmt2.setVerticalAlignment(VerticalAlignment.CENTRE);
            wcfmt2.setWrap(true);

            // 第一行
            sheet.mergeCells(0, 0, 8, 0);
            sheet.addCell(new Label(0, 0, titleName, wcfmt));
            sheet.setRowView(0, 1000);

            // 第二行
            String second = String.format("楼号: %s        (每周至少一次)", huaLongToiletDownDto.getBuildNo());
            sheet.mergeCells(0, 1, 8, 1);
            sheet.addCell(new Label(0, 1, second, wcfmt2));
            sheet.setRowView(1, 450);

			// 设置宽度
			sheet.setColumnView(0, 20);     // 日期
			sheet.setColumnView(1, 20);     // 序号
			sheet.setColumnView(2, 20);     // 姓名
			sheet.setColumnView(5, 20);     // 消毒时间
			sheet.setColumnView(6, 20);     // 消毒浓度
			sheet.setColumnView(7, 20);     // 消毒人
			sheet.setColumnView(8, 20);     // 备注

			// 设置高度
			sheet.setRowView(2, 450);       // 第二行
			sheet.setRowView(3, 450);       // 第三行

            // ************************ 表头 第三行 / 第四行 ************************//
            // 表头 ==> 日期
            sheet.mergeCells(0, 2, 0, 3);
            sheet.addCell(new Label(0, 2, "日期", wcfmt2));
            // 表头 ==> 序号
            sheet.mergeCells(1, 2, 1, 3);
            sheet.addCell(new Label(1, 2, "序号", wcfmt2));
            // 表头 ==> 姓名
            sheet.mergeCells(2, 2, 2, 3);
            sheet.addCell(new Label(2, 2, "姓名", wcfmt2));
            // 表头 ==> 便器消毒
            sheet.mergeCells(3, 2, 4, 2);
            sheet.addCell(new Label(3, 2, "便器消毒", wcfmt2));
            // 表头 ==> 坐便器
            sheet.addCell(new Label(3, 3, "坐便器", wcfmt2));
            // 表头 ==> 尿壶
            sheet.addCell(new Label(4, 3, "尿壶", wcfmt2));
            // 表头 ==> 消毒时间
            sheet.mergeCells(5, 2, 5, 3);
            sheet.addCell(new Label(5, 2, "消毒时间", wcfmt2));
            // 表头 ==> 消毒浓度
            sheet.mergeCells(6, 2, 6, 3);
            sheet.addCell(new Label(6, 2, "消毒浓度\n1000mg/L", wcfmt2));
            // 表头 ==> 消毒人
            sheet.mergeCells(7, 2, 7, 3);
            sheet.addCell(new Label(7, 2, "消毒人", wcfmt2));
            // 表头 ==> 备注
            sheet.mergeCells(8, 2, 8, 3);
            sheet.addCell(new Label(8, 2, "备注", wcfmt2));

			int row = 4;
			if (PublicUtil.isNotEmpty(huaLongToiletDsftRecordVoList)) {
				for (HuaLongToiletDsftRecordVo hltdr : huaLongToiletDsftRecordVoList) {
					// 日期
					sheet.addCell(new Label(0, row, hltdr.getRecordDate(), wcfmt2));
					// 序号
					sheet.addCell(new Label(1, row, hltdr.getBedNo(), wcfmt1));
					// 姓名
					sheet.addCell(new Label(2, row, hltdr.getElderName(), wcfmt1));
					// 便器消毒
					int toilet = hltdr.getToilet();
					if (1 == toilet) {
						sheet.addCell(new Label(3, row, "√", wcfmt1));
					} else {
						sheet.addCell(new Label(3, row, "", wcfmt1));
					}
					// 坐便器
					int urinal = hltdr.getUrinal();
					if (1 == urinal) {
						sheet.addCell(new Label(4, row, "√", wcfmt1));
					} else {
						sheet.addCell(new Label(4, row, "", wcfmt1));
					}
					// 消毒时间
					sheet.addCell(new Label(5, row, hltdr.getDsftTime(), wcfmt1));
					// 消毒浓度
					sheet.addCell(new Label(6, row, "", wcfmt1));
					// 消毒人
					sheet.addCell(new Label(7, row, hltdr.getNurseName(), wcfmt1));
					// 备注
					sheet.addCell(new Label(8, row, hltdr.getRemark(), wcfmt1));
					// 设置高度
					sheet.setRowView(row, 450);

					// 换下一行
					row++;
				}
			}

            // ************************ 表尾 最后一行 ************************//

            // 表尾 ==> 要求
            sheet.addCell(new Label(0, row, "要求", wcfmt2));
            // 表尾 ==> 内容
            sheet.mergeCells(1, row, 8, row);
            sheet.addCell(new Label(1, row, "浸泡; 将洗净的便器浸泡于1000mg/L的有效氯溶液中30分钟, 请清水洗净晾干备用.", wcfmt2));
			// 设置表尾行高
			sheet.setRowView(row, 450);

			// 写入Excel工作表
			workbook.write();

			//关闭Excel工作薄对象
			workbook.close();

			//关闭流
			os.flush();
			os.close();

			os = null;

		} catch (Exception e){
			e.printStackTrace();
		}


	}

	/**
	 * 巡视记录报表导出（机构, 时间）
	 *
	 * @param response
	 * @param huaLongTourRecordVoList
	 * @param titleName
	 * @param sheetName
	 * @param huaLongTourDownDto
	 */
	public static void tourDown(HttpServletResponse response,
								List<HuaLongTourRecordVo> huaLongTourRecordVoList,
								String titleName,
								String sheetName,
								HuaLongTourDownDto huaLongTourDownDto) {

		OutputStream os = null;
		WritableWorkbook workbook = null;

		try {

			os = response.getOutputStream();
			workbook = Workbook.createWorkbook(os);

			WritableSheet sheet = workbook.createSheet(sheetName, 0);

			//创建画笔
			//第一种画笔
			WritableFont wft = new WritableFont(WritableFont.ARIAL, 20, WritableFont.BOLD, false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK);
			WritableCellFormat wcfmt = new WritableCellFormat(wft);
			wcfmt.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN);
			//设置水平居中
			wcfmt.setAlignment(Alignment.CENTRE);
			//设置垂直居中
			wcfmt.setVerticalAlignment(VerticalAlignment.CENTRE);
			wcfmt.setWrap(true);

			//第二种画笔
			WritableFont wft1 = new WritableFont(WritableFont.ARIAL, 12, WritableFont.NO_BOLD, false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK);
			WritableCellFormat wcfmt1 = new WritableCellFormat(wft1);
			wcfmt1.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN);
			wcfmt1.setAlignment(Alignment.CENTRE);
			//设置垂直居中
			wcfmt1.setVerticalAlignment(VerticalAlignment.CENTRE);
			wcfmt1.setWrap(true);

			//第三种画笔
			WritableFont wft2 = new WritableFont(WritableFont.ARIAL, 12, WritableFont.BOLD, false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK);
			WritableCellFormat wcfmt2 = new WritableCellFormat(wft2);
			wcfmt2.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN);
			//设置水平居中
			wcfmt2.setAlignment(Alignment.CENTRE);
			//设置垂直居中
			wcfmt2.setVerticalAlignment(VerticalAlignment.CENTRE);
			wcfmt2.setWrap(true);

			// 第一行
			sheet.mergeCells(0, 0, 2, 0);
			sheet.addCell(new Label(0, 0, titleName, wcfmt));
			sheet.setRowView(0, 1000);

			// ************************ 表头 第二行 ************************//
			// 表头 ==> 日期
			sheet.addCell(new Label(0, 1, "日期", wcfmt2));
			// 表头 ==> 巡视情况
			sheet.addCell(new Label(1, 1, "巡视情况", wcfmt2));
			// 表头 ==> 姓名
			sheet.addCell(new Label(2, 1, "巡视人姓名", wcfmt2));

			// 设置高度
			sheet.setRowView(1, 450);       // 第二行

			// 设置宽度
			sheet.setColumnView(0, 26);     // 日期
			sheet.setColumnView(1, 80);     // 巡视情况
			sheet.setColumnView(2, 20);     // 巡视人姓名

			int row = 2;
			if (PublicUtil.isNotEmpty(huaLongTourRecordVoList)) {
				for (HuaLongTourRecordVo hltr : huaLongTourRecordVoList) {
					// 日期
					sheet.addCell(new Label(0, row, hltr.getRecordDate(), wcfmt2));
					// 巡视情况
					sheet.addCell(new Label(1, row, hltr.getConditions(), wcfmt1));
					// 巡视人姓名
					sheet.addCell(new Label(2, row, hltr.getNursingName(), wcfmt1));

					// 设置高度
					sheet.setRowView(row, 450);

					// 换下一行
					row++;
				}
			}

			// 写入Excel工作表
			workbook.write();

			//关闭Excel工作薄对象
			workbook.close();

			//关闭流
			os.flush();
			os.close();

			os = null;
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	/**
	 * 体温报表导出（老人Id, 时间）
	 *
	 * @param response
	 * @param huaLongTemperatureRecordVoList
	 * @param titleName
	 * @param sheetName
	 * @param huaLongTemperatureDownDto
	 */
	public static void temperatureDown(HttpServletResponse response,
									   List<HuaLongTemperatureRecordVo> huaLongTemperatureRecordVoList,
									   String titleName, String sheetName,
									   HuaLongTemperatureDownDto huaLongTemperatureDownDto) {

		OutputStream os = null;
		WritableWorkbook workbook = null;

		try {

			os = response.getOutputStream();
			workbook = Workbook.createWorkbook(os);

			WritableSheet sheet = workbook.createSheet(sheetName, 0);

			//创建画笔
			//第一种画笔
			WritableFont wft = new WritableFont(WritableFont.ARIAL, 20, WritableFont.BOLD, false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK);
			WritableCellFormat wcfmt = new WritableCellFormat(wft);
			wcfmt.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN);
			//设置水平居中
			wcfmt.setAlignment(Alignment.CENTRE);
			//设置垂直居中
			wcfmt.setVerticalAlignment(VerticalAlignment.CENTRE);
			wcfmt.setWrap(true);

			//第二种画笔
			WritableFont wft1 = new WritableFont(WritableFont.ARIAL, 12, WritableFont.NO_BOLD, false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK);
			WritableCellFormat wcfmt1 = new WritableCellFormat(wft1);
			wcfmt1.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN);
			wcfmt1.setAlignment(Alignment.CENTRE);
			//设置垂直居中
			wcfmt1.setVerticalAlignment(VerticalAlignment.CENTRE);
			wcfmt1.setWrap(true);

			//第三种画笔
			WritableFont wft2 = new WritableFont(WritableFont.ARIAL, 12, WritableFont.BOLD, false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK);
			WritableCellFormat wcfmt2 = new WritableCellFormat(wft2);
			wcfmt2.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN);
			//设置水平居中
			wcfmt2.setAlignment(Alignment.CENTRE);
			//设置垂直居中
			wcfmt2.setVerticalAlignment(VerticalAlignment.CENTRE);
			wcfmt2.setWrap(true);

			// 第一行
			sheet.mergeCells(0, 0, 2, 0);
			sheet.addCell(new Label(0, 0, titleName, wcfmt));
			sheet.setRowView(0, 1000);

			String oldmanName = "";
			String roomNo = "";
			String bedNo = "";

			if (PublicUtil.isNotEmpty(huaLongTemperatureRecordVoList)) {
				HuaLongTemperatureRecordVo vo = huaLongTemperatureRecordVoList.get(0);

                oldmanName = vo.getOldmanName();
                roomNo = vo.getRoomNo();
                bedNo = vo.getBedNo();
			}

            // 第二行
            String second = String.format("姓名: %s      房号: %s      床号: %s",
                    oldmanName, roomNo, bedNo);
            sheet.mergeCells(0, 1, 2, 1);
            sheet.addCell(new Label(0, 1, second, wcfmt2));
            sheet.setRowView(1, 450);

			// ************************ 表头 第三行 ************************//
			// 表头 ==> 日期
			sheet.addCell(new Label(0, 2, "日期", wcfmt2));
			// 表头 ==> 体温
			sheet.addCell(new Label(1, 2, "体温(°C)", wcfmt2));
			// 表头 ==> 测量人
			sheet.addCell(new Label(2, 2, "测量人", wcfmt2));

			// 设置高度
			sheet.setRowView(2, 450);       // 第二行

			// 设置宽度
			sheet.setColumnView(0, 40);     // 日期
			sheet.setColumnView(1, 30);     // 体温
			sheet.setColumnView(2, 30);     // 测量人

			 // 体温记录
			int row = 3;
			if (PublicUtil.isNotEmpty(huaLongTemperatureRecordVoList)) {
				for (HuaLongTemperatureRecordVo hltr : huaLongTemperatureRecordVoList) {
					// 日期
					sheet.addCell(new Label(0, row, hltr.getRecordDate(), wcfmt2));
					// 体温
					sheet.addCell(new Label(1, row, hltr.getTemperature(), wcfmt1));
					// 测量人
					sheet.addCell(new Label(2, row, hltr.getDoctor(), wcfmt1));

					// 设置高度
					sheet.setRowView(row, 450);

					// 换下一行
					row++;
				}
			}


			// 写入Excel工作表
			workbook.write();

			//关闭Excel工作薄对象
			workbook.close();

			//关闭流
			os.flush();
			os.close();

			os = null;
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	/**
	 * 血压报表导出（老人Id, 时间）
	 *
	 * @param response
	 * @param huaLongBloodPressureRecordVoList
	 * @param titleName
	 * @param sheetName
	 * @param huaLongBloodPressureDownDto
	 */
	public static void bloodPressureDown(HttpServletResponse response,
										 List<HuaLongBloodPressureRecordVo> huaLongBloodPressureRecordVoList,
										 String titleName, String sheetName,
										 HuaLongBloodPressureDownDto huaLongBloodPressureDownDto) {

		OutputStream os = null;
		WritableWorkbook workbook = null;

		try {

			os = response.getOutputStream();
			workbook = Workbook.createWorkbook(os);

			WritableSheet sheet = workbook.createSheet(sheetName, 0);

			//创建画笔
			//第一种画笔
			WritableFont wft = new WritableFont(WritableFont.ARIAL, 20, WritableFont.BOLD, false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK);
			WritableCellFormat wcfmt = new WritableCellFormat(wft);
			wcfmt.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN);
			//设置水平居中
			wcfmt.setAlignment(Alignment.CENTRE);
			//设置垂直居中
			wcfmt.setVerticalAlignment(VerticalAlignment.CENTRE);
			wcfmt.setWrap(true);

			//第二种画笔
			WritableFont wft1 = new WritableFont(WritableFont.ARIAL, 12, WritableFont.NO_BOLD, false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK);
			WritableCellFormat wcfmt1 = new WritableCellFormat(wft1);
			wcfmt1.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN);
			wcfmt1.setAlignment(Alignment.CENTRE);
			//设置垂直居中
			wcfmt1.setVerticalAlignment(VerticalAlignment.CENTRE);
			wcfmt1.setWrap(true);

			//第三种画笔
			WritableFont wft2 = new WritableFont(WritableFont.ARIAL, 12, WritableFont.BOLD, false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK);
			WritableCellFormat wcfmt2 = new WritableCellFormat(wft2);
			wcfmt2.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN);
			//设置水平居中
			wcfmt2.setAlignment(Alignment.CENTRE);
			//设置垂直居中
			wcfmt2.setVerticalAlignment(VerticalAlignment.CENTRE);
			wcfmt2.setWrap(true);

			// 第一行
			sheet.mergeCells(0, 0, 3, 0);
			sheet.addCell(new Label(0, 0, titleName, wcfmt));
			sheet.setRowView(0, 1000);

			String buildingNo = "";
			String oldmanName = "";
			String roomNo = "";
			String medicalRecordNo = "";
			if (PublicUtil.isNotEmpty(huaLongBloodPressureRecordVoList)) {
                HuaLongBloodPressureRecordVo vo = huaLongBloodPressureRecordVoList.get(0);
                buildingNo = vo.getBuildingNo();
                oldmanName = vo.getOldmanName();
                roomNo = vo.getRoomNo();
                medicalRecordNo = vo.getMedicalRecordNo();
			}

            // 第二行
            String second = String.format("房号: %s    床号: %s    姓名: %s    病案号: %s",
					roomNo, oldmanName, roomNo, medicalRecordNo);
            sheet.mergeCells(0, 1, 3, 1);
            sheet.addCell(new Label(0, 1, second, wcfmt2));
            sheet.setRowView(1, 450);

			// ************************ 表头 第三行 ************************//
			// 表头 ==> 日期
			sheet.addCell(new Label(0, 2, "日期", wcfmt2));
			// 表头 ==> 舒张压
			sheet.addCell(new Label(1, 2, "舒张压", wcfmt2));
			// 表头 ==> 舒张压
			sheet.addCell(new Label(2, 2, "收缩压", wcfmt2));
			// 表头 ==> 测量人
			sheet.addCell(new Label(3, 2, "测量人", wcfmt2));

			// 设置高度
			sheet.setRowView(2, 450);       // 第二行

			// 设置宽度
			sheet.setColumnView(0, 40);     // 日期
			sheet.setColumnView(1, 30);     // 舒张压
			sheet.setColumnView(1, 30);     // 收缩压
			sheet.setColumnView(2, 30);     // 测量人

			// 体温记录
			int row = 3;
			if (PublicUtil.isNotEmpty(huaLongBloodPressureRecordVoList)) {
				for (HuaLongBloodPressureRecordVo hlbpr : huaLongBloodPressureRecordVoList) {
					// 日期
					sheet.addCell(new Label(0, row, hlbpr.getRecordDate(), wcfmt2));
					// 舒张压
					sheet.addCell(new Label(1, row, hlbpr.getDbp(), wcfmt1));
					// 收缩压
					sheet.addCell(new Label(2, row, hlbpr.getSbp(), wcfmt1));
					// 测量人
					sheet.addCell(new Label(3, row, hlbpr.getDoctor(), wcfmt1));

					// 设置高度
					sheet.setRowView(row, 450);

					// 换下一行
					row++;
				}
			}


			// 写入Excel工作表
			workbook.write();

			//关闭Excel工作薄对象
			workbook.close();

			//关闭流
			os.flush();
			os.close();

			os = null;
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	/**
	 * 电梯消毒记录表导出
	 *
	 * @param response
	 * @param omcDisinfectionRecordVos
	 * @param titleName
	 * @param sheetName
	 */
	public static void elevatorDsftDown(HttpServletResponse response,
										List<OmcDisinfectionRecordVo> omcDisinfectionRecordVos,
									    String titleName,
									    String sheetName,
										DisinfectionRecordDto disinfectionRecordDto) {

		OutputStream os = null;
		WritableWorkbook workbook = null;

		try{

			os = response.getOutputStream();
			workbook = Workbook.createWorkbook(os);

			WritableSheet sheet = workbook.createSheet(sheetName, 0);

			//创建画笔
			//第一种画笔
			WritableFont wft = new WritableFont(WritableFont.ARIAL,20,WritableFont.BOLD,false,UnderlineStyle.NO_UNDERLINE,Colour.BLACK);
			WritableCellFormat wcfmt = new WritableCellFormat(wft);
			wcfmt.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
			//设置水平居中
			wcfmt.setAlignment(Alignment.CENTRE);
			//设置垂直居中
			wcfmt.setVerticalAlignment(VerticalAlignment.CENTRE);
			wcfmt.setWrap(true);

			//第二种画笔
			WritableFont wft1 = new WritableFont(WritableFont.ARIAL,8,WritableFont.NO_BOLD,false,UnderlineStyle.NO_UNDERLINE,Colour.BLACK);
			WritableCellFormat wcfmt1 = new WritableCellFormat(wft1);
			wcfmt1.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
			wcfmt1.setAlignment(Alignment.CENTRE);
			//设置垂直居中
			wcfmt1.setVerticalAlignment(VerticalAlignment.CENTRE);
			wcfmt1.setWrap(true);

			//第三种画笔
			WritableFont wft2 = new WritableFont(WritableFont.ARIAL,12,WritableFont.BOLD,false,UnderlineStyle.NO_UNDERLINE,Colour.BLACK);
			WritableCellFormat wcfmt2 = new WritableCellFormat(wft2);
			wcfmt2.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
			//设置水平居中
			wcfmt2.setAlignment(Alignment.CENTRE);
			//设置垂直居中
			wcfmt2.setVerticalAlignment(VerticalAlignment.CENTRE);
			wcfmt2.setWrap(true);

			// 第一行
			sheet.mergeCells(0, 0, 4, 0);
			sheet.addCell(new Label(0, 0, titleName, wcfmt));
			sheet.setRowView(0, 1000);

			// 第二行
			String second = String.format("要求：每日晚餐后用含250mg/L消毒液湿拖、擦拭或喷洒，作用十分钟后用清水清洁干净，受到污染随时消毒");
			sheet.mergeCells(0, 1, 4, 1);
			sheet.addCell(new Label(0, 1, second, wcfmt1));
			sheet.setRowView(1, 450);

			// 设置宽度
			sheet.setColumnView(0, 20);     // 日期/项目
			sheet.setColumnView(1, 20);     // 轿厢
			sheet.setColumnView(2, 20);     // 地面
			sheet.setColumnView(3, 20);     // 扶手门
			sheet.setColumnView(4, 20);     // 消毒人

			// 设置高度
			sheet.setRowView(2, 450);       // 第二行
			sheet.setRowView(3, 450);       // 第三行

			// ************************ 表头 第三行 / 第四行 ************************//
			// 表头 ==> 日期
			sheet.mergeCells(0, 2, 0, 3);
			sheet.addCell(new Label(0, 2, "日期", wcfmt2));
			// 表头 ==> 项目
			sheet.mergeCells(1,2,3,2);
			sheet.addCell(new Label(1, 2, "项目", wcfmt2));
			// 表头 ==> 轿厢
//			sheet.mergeCells(1, 3, 1, 2);
			sheet.addCell(new Label(1, 3, "轿厢", wcfmt2));
			// 表头 ==> 地面
//			sheet.mergeCells(2, 3, 2, 3);
			sheet.addCell(new Label(2, 3, "地面", wcfmt2));
			// 表头 ==> 扶手门
//			sheet.mergeCells(3, 3, 3, 3);
			sheet.addCell(new Label(3, 3, "扶手门", wcfmt2));
			// 表头 ==> 消毒人
			sheet.mergeCells(4, 2, 4, 3);
			sheet.addCell(new Label(4, 2, "消毒人", wcfmt2));


			int row = 4;
			if(PublicUtil.isNotEmpty(omcDisinfectionRecordVos)){
//				SimpleDateFormat simpleDateFormat = new SimpleDateFormat("MM-DD");

				for(OmcDisinfectionRecordVo vo:omcDisinfectionRecordVos){
					//日期
					sheet.addCell(new Label(0,row,vo.getDisinfectionDate().substring(5),wcfmt2));
					int car=0,ground=0,handrailDoor=0;
					List<OmcDisinfectionRecordBind> binds = vo.getOmcDisinfectionRecordBinds();
					for(OmcDisinfectionRecordBind bind:binds){
						if(bind.getDisinfectionArea().equals("轿厢")){
							car=1;
						}else if(bind.getDisinfectionArea().equals("地面")){
							ground=1;
						}else if(bind.getDisinfectionArea().equals("扶手门")){
							handrailDoor=1;
						}
					}
					//轿厢
					if(car==1){
						sheet.addCell(new Label(1,row,"√",wcfmt2));
					}else {
						sheet.addCell(new Label(1,row,"",wcfmt2));
					}
					//地面
					if(ground==1){
						sheet.addCell(new Label(2,row,"√",wcfmt2));
					}else {
						sheet.addCell(new Label(2,row,"",wcfmt2));
					}
					//扶手门
					if(handrailDoor==1){
						sheet.addCell(new Label(3,row,"√",wcfmt2));
					}else {
						sheet.addCell(new Label(3,row,"",wcfmt2));
					}
					//消毒人
					sheet.addCell(new Label(4,row,vo.getCreator(),wcfmt2));

					// 设置高度
					sheet.setRowView(row, 450);

					// 换下一行
					row++;
				}
			}


			// 写入Excel工作表
			workbook.write();

			//关闭Excel工作薄对象
			workbook.close();

			//关闭流
			os.flush();
			os.close();

			os = null;

		} catch (Exception e){
			e.printStackTrace();
		}


	}

	/**
	 * 送餐车消毒记录表导出
	 *
	 * @param response
	 * @param omcDisinfectionRecordVos
	 * @param titleName
	 * @param sheetName
	 */
	public static void diningCarDsftDown(HttpServletResponse response,
										List<OmcDisinfectionRecordVo> omcDisinfectionRecordVos,
										String titleName,
										String sheetName,
										DisinfectionRecordDto disinfectionRecordDto) {

		OutputStream os = null;
		WritableWorkbook workbook = null;

		try{

			os = response.getOutputStream();
			workbook = Workbook.createWorkbook(os);

			WritableSheet sheet = workbook.createSheet(sheetName, 0);

			//创建画笔
			//第一种画笔
			WritableFont wft = new WritableFont(WritableFont.ARIAL,20,WritableFont.BOLD,false,UnderlineStyle.NO_UNDERLINE,Colour.BLACK);
			WritableCellFormat wcfmt = new WritableCellFormat(wft);
			wcfmt.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
			//设置水平居中
			wcfmt.setAlignment(Alignment.CENTRE);
			//设置垂直居中
			wcfmt.setVerticalAlignment(VerticalAlignment.CENTRE);
			wcfmt.setWrap(true);

			//第二种画笔
			WritableFont wft1 = new WritableFont(WritableFont.ARIAL,12,WritableFont.NO_BOLD,false,UnderlineStyle.NO_UNDERLINE,Colour.BLACK);
			WritableCellFormat wcfmt1 = new WritableCellFormat(wft1);
			wcfmt1.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
			wcfmt1.setAlignment(Alignment.CENTRE);
			//设置垂直居中
			wcfmt1.setVerticalAlignment(VerticalAlignment.CENTRE);
			wcfmt1.setWrap(true);

			//第三种画笔
			WritableFont wft2 = new WritableFont(WritableFont.ARIAL,12,WritableFont.BOLD,false,UnderlineStyle.NO_UNDERLINE,Colour.BLACK);
			WritableCellFormat wcfmt2 = new WritableCellFormat(wft2);
			wcfmt2.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
			//设置水平居中
			wcfmt2.setAlignment(Alignment.CENTRE);
			//设置垂直居中
			wcfmt2.setVerticalAlignment(VerticalAlignment.CENTRE);
			wcfmt2.setWrap(true);

			// 第一行
			sheet.mergeCells(0, 0, 4, 0);
			sheet.addCell(new Label(0, 0, titleName, wcfmt));
			sheet.setRowView(0, 1000);

			// 第二行
			String second = String.format("用250mg/L含氯消毒液喷洒消毒");
			sheet.mergeCells(0, 1, 4, 1);
			sheet.addCell(new Label(0, 1, second, wcfmt1));
			sheet.setRowView(1, 450);

			// 设置宽度
			sheet.setColumnView(0, 20);     // 日期/项目
			sheet.setColumnView(1, 20);     // 早
			sheet.setColumnView(2, 20);     // 中
			sheet.setColumnView(3, 20);     // 晚
			sheet.setColumnView(4, 20);     // 消毒人

			// 设置高度
			sheet.setRowView(2, 450);       // 第二行
			sheet.setRowView(3, 450);       // 第三行

			// ************************ 表头 第三行 / 第四行 ************************//
			// 表头 ==> 日期
			sheet.mergeCells(0, 2, 0, 3);
			sheet.addCell(new Label(0, 2, "日期", wcfmt2));

			// 表头 ==> 清洁消毒时间
			sheet.mergeCells(1,2,3,2);
			sheet.addCell(new Label(1, 2, "清洁消毒时间", wcfmt2));
			// 表头 ==> 早
//			sheet.mergeCells(1, 3, 1, 2);
			sheet.addCell(new Label(1, 3, "早", wcfmt2));
			// 表头 ==> 中
//			sheet.mergeCells(2, 3, 2, 3);
			sheet.addCell(new Label(2, 3, "中", wcfmt2));
			// 表头 ==> 晚
//			sheet.mergeCells(3, 3, 3, 3);
			sheet.addCell(new Label(3, 3, "晚", wcfmt2));
			// 表头 ==> 消毒人

			sheet.mergeCells(4, 2, 4, 3);
			sheet.addCell(new Label(4, 2, "消毒人", wcfmt2));


			int row = 4;
			if(PublicUtil.isNotEmpty(omcDisinfectionRecordVos)){

				for(OmcDisinfectionRecordVo vo:omcDisinfectionRecordVos){
					//日期
					sheet.addCell(new Label(0,row,vo.getDisinfectionDate().substring(5),wcfmt2));
					int car=0,ground=0,handrailDoor=0;
					List<OmcDisinfectionRecordBind> binds = vo.getOmcDisinfectionRecordBinds();
					for(OmcDisinfectionRecordBind bind:binds){
						if(bind.getDisinfectionArea().equals("早")){
							car=1;
						}else if(bind.getDisinfectionArea().equals("中")){
							ground=1;
						}else if(bind.getDisinfectionArea().equals("晚")){
							handrailDoor=1;
						}
					}
					//轿厢
					if(car==1){
						sheet.addCell(new Label(1,row,"√",wcfmt2));
					}else {
						sheet.addCell(new Label(1,row,"",wcfmt2));
					}
					//地面
					if(ground==1){
						sheet.addCell(new Label(2,row,"√",wcfmt2));
					}else {
						sheet.addCell(new Label(2,row,"",wcfmt2));
					}
					//扶手门
					if(handrailDoor==1){
						sheet.addCell(new Label(3,row,"√",wcfmt2));
					}else {
						sheet.addCell(new Label(3,row,"",wcfmt2));
					}
					//消毒人
					sheet.addCell(new Label(4,row,vo.getCreator(),wcfmt2));

					// 设置高度
					sheet.setRowView(row, 450);

					// 换下一行
					row++;
				}
			}

			// ************************ 表尾 最后一行 ************************//

			// 表尾 ==> 内容
			sheet.mergeCells(0, row, 4, row);
			sheet.addCell(new Label(0, row, "要求：送餐车早，中饭送餐后作清洁处理；晚饭开饭结束，送餐车先清洗，后消毒.", wcfmt1));
			// 设置表尾行高
			sheet.setRowView(row, 450);

            // 写入Excel工作表
            workbook.write();

            //关闭Excel工作薄对象
            workbook.close();

            //关闭流
            os.flush();
            os.close();

            os = null;

        } catch (Exception e){
            e.printStackTrace();
        }


    }

	/**
	 *
	 *   jxl导出excel
	 *   @author ZNR
	 *   @date  2020-11-18
	 *
	 * 长期医嘱单报表导出（老人Id, 时间）
	 *
	 * @param response
	 * @param doctorWorkMedicalAdviceDownVoList
	 * @param titleName
	 * @param sheetName
	 * @param doctorWorkMedicalAdviceDownDto
	 */
	public static void medicalAdviceDown(HttpServletResponse response,
										 List<DoctorWorkMedicalAdviceDownVo> doctorWorkMedicalAdviceDownVoList,
										 String titleName, String sheetName,
										 DoctorWorkMedicalAdviceDownDto doctorWorkMedicalAdviceDownDto) {

		OutputStream os = null;
		WritableWorkbook workbook = null;

		try {

			os = response.getOutputStream();
			workbook = Workbook.createWorkbook(os);

			WritableSheet sheet = workbook.createSheet(sheetName, 0);

			//创建画笔
			//第一种画笔
			WritableFont wft = new WritableFont(WritableFont.ARIAL, 20, WritableFont.BOLD, false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK);
			WritableCellFormat wcfmt = new WritableCellFormat(wft);
			wcfmt.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN);
			//设置水平居中
			wcfmt.setAlignment(Alignment.CENTRE);
			//设置垂直居中
			wcfmt.setVerticalAlignment(VerticalAlignment.CENTRE);
			wcfmt.setWrap(true);

			//第二种画笔
			WritableFont wft1 = new WritableFont(WritableFont.ARIAL, 12, WritableFont.NO_BOLD, false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK);
			WritableCellFormat wcfmt1 = new WritableCellFormat(wft1);
			wcfmt1.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN);
			wcfmt1.setAlignment(Alignment.CENTRE);
			//设置垂直居中
			wcfmt1.setVerticalAlignment(VerticalAlignment.CENTRE);
			wcfmt1.setWrap(true);

			//第三种画笔
			WritableFont wft2 = new WritableFont(WritableFont.ARIAL, 12, WritableFont.BOLD, false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK);
			WritableCellFormat wcfmt2 = new WritableCellFormat(wft2);
			wcfmt2.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN);
			//设置水平居中
			wcfmt2.setAlignment(Alignment.CENTRE);
			//设置垂直居中
			wcfmt2.setVerticalAlignment(VerticalAlignment.CENTRE);
			wcfmt2.setWrap(true);

			// 第一行
			sheet.mergeCells(0, 0, 7, 0);
			sheet.addCell(new Label(0, 0, titleName, wcfmt));
			sheet.setRowView(0, 1000);

			String oldmanName = "";
			String buildingNo = "";
			String roomNo = "";
			String bedNo = "";
			if (PublicUtil.isNotEmpty(doctorWorkMedicalAdviceDownVoList)) {
				DoctorWorkMedicalAdviceDownVo vo = doctorWorkMedicalAdviceDownVoList.get(0);
				oldmanName = vo.getOldmanName();
				buildingNo = vo.getBuildingNo();
				roomNo = vo.getRoomNo();
				bedNo = vo.getBedNo();
			}

			// 第二行
			String second = String.format("姓名: %s    楼栋: %s    房号: %s    床号: %s",
					oldmanName, buildingNo, roomNo, bedNo);
			sheet.mergeCells(0, 1, 7, 1);
			sheet.addCell(new Label(0, 1, second, wcfmt2));
			sheet.setRowView(1, 450);

			// ************************ 表头 第三行 ************************//
			// 表头 ==> 医嘱日期
			sheet.addCell(new Label(0,2,"医嘱日期",wcfmt2));
			// 表头 ==> 医生签名
			sheet.addCell(new Label(1,2,"医生签名",wcfmt2));
			// 表头 ==> 护士签名
			sheet.addCell(new Label(2,2,"护士签名",wcfmt2));
			// 表头 ==> 长期医嘱
			sheet.addCell(new Label(3,2,"长期医嘱",wcfmt2));
			// 表头 ==> 停止日期
			sheet.addCell(new Label(4,2,"停止日期",wcfmt2));
			// 表头 ==> 医生签名
			sheet.addCell(new Label(5,2,"医生签名",wcfmt2));
			// 表头 ==> 护士签名
			sheet.addCell(new Label(6,2,"护士签名",wcfmt2));
			// 表头 ==> 费用结算金额
			sheet.addCell(new Label(7,2,"费用结算金额",wcfmt2));

			// 设置高度
			sheet.setRowView(2, 900);       // 第二行

			// 设置宽度
			sheet.setColumnView(0,15);    // 医嘱日期
			sheet.setColumnView(1,15);    // 医生签名
			sheet.setColumnView(2,15);    // 护士签名
			sheet.setColumnView(3,45);    // 长期医嘱
			sheet.setColumnView(4,15);    // 停止日期
			sheet.setColumnView(5,15);    // 医生签名
			sheet.setColumnView(6,15);    // 护士签名
			sheet.setColumnView(7,20);    // 费用结算金F额

			// 长期医嘱单记录
			int row = 3;
			if (PublicUtil.isNotEmpty(doctorWorkMedicalAdviceDownVoList)) {
				for (DoctorWorkMedicalAdviceDownVo hlbpr : doctorWorkMedicalAdviceDownVoList) {
					// 医嘱日期
					sheet.addCell(new Label(0, row, hlbpr.getMedicalAdviceTime(), wcfmt1));
					// 医生签名
					sheet.addCell(new Label(1, row, hlbpr.getDoctorName(), wcfmt1));
					// 护士签名
					sheet.addCell(new Label(2, row, hlbpr.getNurseName(), wcfmt1));
					// 长期医嘱
					sheet.addCell(new Label(3, row, hlbpr.getMedicalAdvice(), wcfmt1));
					// 停止日期
					sheet.addCell(new Label(4, row, hlbpr.getStopTime(), wcfmt1));
					// 医生签名
					sheet.addCell(new Label(5, row, hlbpr.getDoctorNameStop(), wcfmt1));
					//护士签名
					sheet.addCell(new Label(6, row, hlbpr.getNurseNameStop(), wcfmt1));
					//费用结算金额
					sheet.addCell(new Label(7, row, hlbpr.getCost(), wcfmt1));

					// 设置高度
					sheet.setRowView(row, 1200);

					// 换下一行
					row++;
				}
			}


			// 写入Excel工作表
			workbook.write();

			//关闭Excel工作薄对象
			workbook.close();

			//关闭流
			os.flush();
			os.close();

			os = null;
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	/**
	 *
	 *   jxl导出excel
	 *   @author ZNR
	 *   @date  2020-12-17
	 *
	 * 入院账单报表导出（账单ID）
	 *
	 * @param response
	 * @param omcOldManBill
	 * @param titleName
	 * @param sheetName
	 * @param omcOldManBillDetailVo
	 */
	public static void checkInBillDown(HttpServletResponse response,
									   OmcOldManBill omcOldManBill,
									   String titleName, String sheetName,
									   OmcOldManBillDetailVo omcOldManBillDetailVo) {
		OutputStream os = null;
		WritableWorkbook workbook = null;

		try {

			os = response.getOutputStream();
			workbook = Workbook.createWorkbook(os);

			WritableSheet sheet = workbook.createSheet(sheetName, 0);

			//创建画笔
			//第一种画笔
			WritableFont wft = new WritableFont(WritableFont.ARIAL, 20, WritableFont.BOLD, false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK);
			WritableCellFormat wcfmt = new WritableCellFormat(wft);
			wcfmt.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN);
			//设置水平居中
			wcfmt.setAlignment(Alignment.CENTRE);
			//设置垂直居中
			wcfmt.setVerticalAlignment(VerticalAlignment.CENTRE);
			wcfmt.setWrap(true);

			//第二种画笔
			WritableFont wft1 = new WritableFont(WritableFont.ARIAL, 12, WritableFont.NO_BOLD, false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK);
			WritableCellFormat wcfmt1 = new WritableCellFormat(wft1);
			wcfmt1.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN);
			wcfmt1.setAlignment(Alignment.CENTRE);
			//设置垂直居中
			wcfmt1.setVerticalAlignment(VerticalAlignment.CENTRE);
			wcfmt1.setWrap(true);

			//第三种画笔
			WritableFont wft2 = new WritableFont(WritableFont.ARIAL, 12, WritableFont.BOLD, false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK);
			WritableCellFormat wcfmt2 = new WritableCellFormat(wft2);
			wcfmt2.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN);
			//设置水平居中
			wcfmt2.setAlignment(Alignment.CENTRE);
			//设置垂直居中
			wcfmt2.setVerticalAlignment(VerticalAlignment.CENTRE);
			wcfmt2.setWrap(true);

			//第四种画笔
			WritableFont wft3 = new WritableFont(WritableFont.ARIAL, 12, WritableFont.BOLD, false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK);
			WritableCellFormat wcfmt3 = new WritableCellFormat(wft3);
			wcfmt3.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN);
			//设置水平左对齐
			wcfmt3.setAlignment(Alignment.LEFT);
			//设置垂直居中
			wcfmt3.setVerticalAlignment(VerticalAlignment.CENTRE);
			wcfmt3.setWrap(true);

			// 第一行
			sheet.mergeCells(0, 0, 6, 0);
			sheet.addCell(new Label(0, 0, titleName, wcfmt));
			sheet.setRowView(0, 1000);
			//第二行
			sheet.mergeCells(0,1,6,1);
			sheet.addCell(new Label(0, 1, "基本信息", wcfmt3));
			sheet.setRowView(1, 600);
			//第三、四行
			String billNumber = omcOldManBillDetailVo.getBillNumber();
			String oldName = omcOldManBillDetailVo.getOldName();
			String idCard = omcOldManBillDetailVo.getIdCard();
			Integer sex = omcOldManBillDetailVo.getSex();
			String sexStr = "";
			switch (sex){
				case 0:sexStr="男";break;
				case 1:sexStr="女";break;
				default:sexStr="";break;
			}
			String newBedNo = omcOldManBillDetailVo.getNewBedNo();
			String cashPledgeNum = omcOldManBillDetailVo.getCashPledgeNum();
			sheet.mergeCells(0,2,6,3);
			String third = String.format("缴费单号: %s       老人姓名: %s       性别: %s \n身份证号: %s       床位号: %s       押金编号: %s",billNumber,oldName,sexStr,idCard,newBedNo,cashPledgeNum);
			sheet.addCell(new Label(0,2,third,wcfmt1 ));
			sheet.setRowView(2, 1000);
			//第五行-间隔行
			sheet.mergeCells(0,4,6,4);
			sheet.setRowView(4, 500);
			//第六行
			sheet.mergeCells(0,5,6,5);
			sheet.addCell(new Label(0, 5, "入院时间", wcfmt3));
			sheet.setRowView(5, 600);
			//第七行
			String inDate = omcOldManBillDetailVo.getInDate();
			sheet.mergeCells(0,6,6,6);
			String seven =String.format("入院时间: %s",inDate);
			sheet.addCell(new Label(0,6,seven,wcfmt1 ));
			sheet.setRowView(6, 500);
			//第八行-间隔行
			sheet.mergeCells(0,7,6,7);
			sheet.setRowView(7, 500);
			//第九行
			sheet.mergeCells(0,8,5,8);
			sheet.addCell(new Label(0, 8, "入院项目", wcfmt2));
			sheet.setRowView(8, 600);
			//第十行-入院项目表头
			sheet.addCell(new Label(0,9,"缴费类别",wcfmt2));
			sheet.addCell(new Label(1,9,"缴费项目",wcfmt2));
			sheet.addCell(new Label(2,9,"项目费用",wcfmt2));
			sheet.addCell(new Label(3,9,"人员类别减免费用",wcfmt2));
			sheet.addCell(new Label(4,9,"人工减免费用",wcfmt2));
			sheet.addCell(new Label(5,9,"实际费用",wcfmt2));
			sheet.setRowView( 9, 600);
			//第十一行-开始写入数据
			int row = 10;
			List<OmcBillItem> omcBillItemList = omcOldManBillDetailVo.getBillItemList();
			for (OmcBillItem item : omcBillItemList) {
				if (item.getModelCode() == 1) {
					sheet.addCell(new Label(0, row, item.getItemType(), wcfmt1));
					sheet.addCell(new Label(1, row, item.getItemName(), wcfmt1));
					sheet.addCell(new Label(2, row, item.getItemFee().toString(), wcfmt1));
					sheet.addCell(new Label(3, row, item.getUserTypeRateRefief().toString(), wcfmt1));
					sheet.addCell(new Label(4, row, item.getUserRateRefief().toString(), wcfmt1));
					sheet.addCell(new Label(5, row, item.getActualFee().toString(), wcfmt1));
					sheet.setRowView(row, 600);
					row++;
				}
			}
			//第row+1行-间隔行
			sheet.mergeCells(0,row,5,row);
			sheet.setRowView(row, 500);
			//第row+2行
			sheet.mergeCells(0,row+1,6,row+1);
			sheet.addCell(new Label(0, row+1, "周期或非周期项目", wcfmt2));
			sheet.setRowView(row+1, 600);
			//第row+3行-周期或非周期项目表头
			sheet.addCell(new Label(0,row+2,"缴费类别",wcfmt2));
			sheet.addCell(new Label(1,row+2,"缴费项目",wcfmt2));
			sheet.addCell(new Label(2,row+2,"项目费用",wcfmt2));
			sheet.addCell(new Label(3,row+2,"人员类别减免费用",wcfmt2));
			sheet.addCell(new Label(4,row+2,"人工减免费用",wcfmt2));
			sheet.addCell(new Label(5,row+2,"预缴（时间/次数）",wcfmt2));
			sheet.addCell(new Label(6,row+2,"实际费用",wcfmt2));
			sheet.setRowView( row+2, 600);
			//第row+4行-开始写入数据
			int row1 = row+3;
			for (OmcBillItem item1 : omcBillItemList){
				String a;
				switch (item1.getCostType()){
					case 1: a = "(元/次)"; break;
					case 2: a = "(元/天)"; break;
					case 3: a = "(元/月)"; break;
					case 4: a = "(元/年)"; break;
					case 5: a = "(元/一次性)"; break;
					default: a = ""; break;
				}
				if (item1.getModelCode() == 2 || item1.getModelCode() == 4){
					sheet.addCell(new Label(0,row1,item1.getItemType(),wcfmt1));
					sheet.addCell(new Label(1,row1,item1.getItemName(),wcfmt1));
					sheet.addCell(new Label(2, row1, item1.getItemFee().toString(), wcfmt1));
					sheet.addCell(new Label(3, row1, item1.getUserTypeRateRefief().toString(), wcfmt1));
					sheet.addCell(new Label(4, row1, item1.getUserRateRefief().toString(), wcfmt1));
					sheet.addCell(new Label(5, row1, item1.getAmount().toString()+a, wcfmt1));
					sheet.addCell(new Label(6, row1, item1.getActualFee().toString(), wcfmt1));
					sheet.setRowView(row1, 600);
					row1 ++;
				}
			}
			//第row1+1行-间隔行
			sheet.mergeCells(0,row1,6,row1);
			sheet.setRowView(row1, 500);
			//第row1+2行
			sheet.mergeCells(0,row1+1,3,row1+1);
			sheet.addCell(new Label(0, row1+1, "应缴合计", wcfmt2));
			sheet.setRowView(row1+1, 600);
			//第row1+3行-应缴合计表头
			sheet.addCell(new Label(0,row1+2,"实际费用",wcfmt2));
			sheet.addCell(new Label(1,row1+2,"人员类别费用",wcfmt2));
			sheet.addCell(new Label(2,row1+2,"人员减免费用",wcfmt2));
			sheet.addCell(new Label(3,row1+2,"实际缴费",wcfmt2));
			//第row1+4行-写入数据
			OmcBillInHospitalFee fee = omcOldManBillDetailVo.getBillInHospitalFee();
			sheet.addCell(new Label(0,row1+3,fee.getActualFee().toString(),wcfmt1));
			sheet.addCell(new Label(1, row1+3, fee.getUserTypeRateRefief().toString(),wcfmt1));
			sheet.addCell(new Label(2, row1+3,fee.getUserRateRefief().toString(),wcfmt1));
			sheet.addCell(new Label(3, row1+3,fee.getTotalFee().toString(),wcfmt1));
			sheet.setRowView(row1+3,600);

			// 设置宽度
			sheet.setColumnView(0,20);
			sheet.setColumnView(1,20);
			sheet.setColumnView(2,20);
			sheet.setColumnView(3,20);
			sheet.setColumnView(4,20);
			sheet.setColumnView(5,20);
			sheet.setColumnView(6,20);

			// 写入Excel工作表
			workbook.write();

			//关闭Excel工作薄对象
			workbook.close();

			//关闭流
			os.flush();
			os.close();

			os = null;
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	/**
	 *
	 *   jxl导出excel
	 *   @author ZNR
	 *   @date  2020-12-18
	 *
	 * 出院账单报表导出（账单ID）
	 *
	 * @param response
	 * @param titleName
	 * @param sheetName
	 * @param omcOldManBill
	 * @param oldOutVo
	 */
	public static void checkOutBillDown(HttpServletResponse response,
										String titleName, String sheetName,
										OmcOldManBill omcOldManBill,
										OldOutVo oldOutVo){
		OutputStream os = null;
		WritableWorkbook workbook = null;

		try {

			os = response.getOutputStream();
			workbook = Workbook.createWorkbook(os);

			WritableSheet sheet = workbook.createSheet(sheetName, 0);

			//创建画笔
			//第一种画笔
			WritableFont wft = new WritableFont(WritableFont.ARIAL, 20, WritableFont.BOLD, false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK);
			WritableCellFormat wcfmt = new WritableCellFormat(wft);
			wcfmt.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN);
			//设置水平居中
			wcfmt.setAlignment(Alignment.CENTRE);
			//设置垂直居中
			wcfmt.setVerticalAlignment(VerticalAlignment.CENTRE);
			wcfmt.setWrap(true);

			//第二种画笔
			WritableFont wft1 = new WritableFont(WritableFont.ARIAL, 12, WritableFont.NO_BOLD, false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK);
			WritableCellFormat wcfmt1 = new WritableCellFormat(wft1);
			wcfmt1.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN);
			wcfmt1.setAlignment(Alignment.CENTRE);
			//设置垂直居中
			wcfmt1.setVerticalAlignment(VerticalAlignment.CENTRE);
			wcfmt1.setWrap(true);

			//第三种画笔
			WritableFont wft2 = new WritableFont(WritableFont.ARIAL, 12, WritableFont.BOLD, false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK);
			WritableCellFormat wcfmt2 = new WritableCellFormat(wft2);
			wcfmt2.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN);
			//设置水平居中
			wcfmt2.setAlignment(Alignment.CENTRE);
			//设置垂直居中
			wcfmt2.setVerticalAlignment(VerticalAlignment.CENTRE);
			wcfmt2.setWrap(true);

			//第四种画笔
			WritableFont wft3 = new WritableFont(WritableFont.ARIAL, 12, WritableFont.BOLD, false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK);
			WritableCellFormat wcfmt3 = new WritableCellFormat(wft3);
			wcfmt3.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN);
			//设置水平左对齐
			wcfmt3.setAlignment(Alignment.LEFT);
			//设置垂直居中
			wcfmt3.setVerticalAlignment(VerticalAlignment.CENTRE);
			wcfmt3.setWrap(true);

			// 第一行
			sheet.mergeCells(0, 0, 5, 0);
			sheet.addCell(new Label(0, 0, titleName, wcfmt));
			sheet.setRowView(0, 1000);
			//第二行
			sheet.mergeCells(0,1,5,1);
			sheet.addCell(new Label(0, 1, "基本信息", wcfmt3));
			sheet.setRowView(1, 600);
			//第三、四行
			String billNumber = omcOldManBill.getBillNumber();
			String oldmanName = oldOutVo.getOldmanName();
			String idCard = oldOutVo.getIdCard();
			Integer sex = oldOutVo.getSex();
			String sexStr = "";
			switch (sex){
				case 0:sexStr="男";break;
				case 1:sexStr="女";break;
				default:sexStr="";break;
			}
			String bedNo = oldOutVo.getBedNo();
			sheet.mergeCells(0,2,5,3);
			String third = String.format("缴费单号: %s       老人姓名: %s       性别: %s \n身份证号: %s       床位号: %s",billNumber,oldmanName,sexStr,idCard,bedNo);
			sheet.addCell(new Label(0,2,third,wcfmt1 ));
			sheet.setRowView(2, 1000);
			//第五行-间隔行
			sheet.mergeCells(0,4,5,4);
			sheet.setRowView(4, 500);
			//第六行
			sheet.mergeCells(0,5,5,5);
			sheet.addCell(new Label(0, 5, "入院时间", wcfmt3));
			sheet.setRowView(5, 600);
			//第七行
			String inDate = omcOldManBill.getInDate();
			sheet.mergeCells(0,6,5,6);
			String seven =String.format("入院时间: %s",inDate);
			sheet.addCell(new Label(0,6,seven,wcfmt1 ));
			sheet.setRowView(6, 500);
			//第八行-间隔行
			sheet.mergeCells(0,7,5,7);
			sheet.setRowView(7, 500);
			//第九行
			sheet.mergeCells(0,8,5,8);
			sheet.addCell(new Label(0, 8, "应缴项", wcfmt2));
			sheet.setRowView(8, 600);
			//第十行-应缴项表头
			sheet.mergeCells(0,9,2,9);
			sheet.addCell(new Label(0,9,"应缴项",wcfmt2));
			sheet.mergeCells(3,9,5,9);
			sheet.addCell(new Label(3,9,"缴费金额",wcfmt2));
			sheet.setRowView( 9, 600);
			//第十一行-开始写入数据
			int row = 10;
			List<OldOutItemVo> oldOutItemVoList = oldOutVo.getOldOutItemVoList();
			for (OldOutItemVo vo: oldOutItemVoList) {
				if (vo.getAdjustOrder() == 1) {
					sheet.mergeCells(0,row,2,row);
					sheet.addCell(new Label(0, row, vo.getItemName(), wcfmt1));
					sheet.mergeCells(3,row,5,row);
					sheet.addCell(new Label(3, row, vo.getTotalFee().toString(), wcfmt1));
					sheet.setRowView(row, 600);
					row++;
				}
			}
			//第row+1行-间隔行
			sheet.mergeCells(0,row,5,row);
			sheet.setRowView(row, 500);
			//第row+2行
			sheet.mergeCells(0,row+1,5,row+1);
			sheet.addCell(new Label(0, row+1, "退款项", wcfmt2));
			sheet.setRowView(row+1, 600);
			//第row+3行-退款项表头
			sheet.mergeCells(0,row+2,2,row+2);
			sheet.addCell(new Label(0,row+2,"退款项",wcfmt2));
			sheet.mergeCells(3,row+2,5,row+2);
			sheet.addCell(new Label(3,row+2,"缴费金额",wcfmt2));
			sheet.setRowView( row+2, 600);
			//第row+4行-开始写入数据
			int row1 = row+3;
			for (OldOutItemVo vo1 : oldOutItemVoList){
				if (vo1.getAdjustOrder() == 2){
					sheet.mergeCells(0,row1,2,row1);
					sheet.addCell(new Label(0,row1,vo1.getItemName(),wcfmt1));
					sheet.mergeCells(3,row1,5,row1);
					sheet.addCell(new Label(3,row1,vo1.getTotalFee().toString(),wcfmt1));
					sheet.setRowView(row1, 600);
					row1 ++;
				}
			}
			//第row1+1行-间隔行
			sheet.mergeCells(0,row1,5,row1);
			sheet.setRowView(row1, 500);
			//第row1+2行
			sheet.mergeCells(0,row1+1,5,row1+1);
			sheet.addCell(new Label(0, row1+1, "应缴合计", wcfmt2));
			sheet.setRowView(row1+1, 600);
			//第row1+3行-应缴合计表头
			sheet.addCell(new Label(0,row1+2,"请假退费合计",wcfmt2));
			sheet.addCell(new Label(1,row1+2,"本月剩余天数退费合计",wcfmt2));
			sheet.addCell(new Label(2,row1+2,"消费总额",wcfmt2));
			sheet.addCell(new Label(3,row1+2,"退费总额",wcfmt2));
			sheet.addCell(new Label(4,row1+2,"余额",wcfmt2));
			sheet.addCell(new Label(5,row1+2,"应缴金额/退费金额",wcfmt2));
			//第row1+4行-写入数据
			String leaveDaysFee = "0" ;
			List<OldOutDaysFeeVo> oldOutDaysFeeVoList = oldOutVo.getOldOutDaysVoList();
			for (OldOutDaysFeeVo feeVo : oldOutDaysFeeVoList){
				if (feeVo.getType() == 1){
					leaveDaysFee = feeVo.getTotalFee().toString();
				}
			}
			sheet.addCell(new Label(0,row1+3,leaveDaysFee,wcfmt1));
			sheet.addCell(new Label(1, row1+3, oldOutVo.getDaysTotal().toString(),wcfmt1));
			sheet.addCell(new Label(2, row1+3,oldOutVo.getMonetary().toString(),wcfmt1));
			sheet.addCell(new Label(3, row1+3,oldOutVo.getItemsTotal().toString(),wcfmt1));
			sheet.addCell(new Label(4,row1+3,oldOutVo.getRemainder().toString(),wcfmt1));
			sheet.addCell(new Label(5,row1+3,oldOutVo.getTotalPay().toString(),wcfmt1));

			// 设置宽度
			sheet.setColumnView(0,20);
			sheet.setColumnView(1,20);
			sheet.setColumnView(2,20);
			sheet.setColumnView(3,20);
			sheet.setColumnView(4,20);
			sheet.setColumnView(5,20);

			// 写入Excel工作表
			workbook.write();

			//关闭Excel工作薄对象
			workbook.close();

			//关闭流
			os.flush();
			os.close();

			os = null;
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	/**
	 *
	 *   jxl导出excel
	 *   @author ZNR
	 *   @date  2020-12-21
	 *
	 * 调整账单报表导出（账单ID）
	 *
	 * @param response
	 * @param titleName
	 * @param sheetName
	 * @param omcOldManBill
	 * @param reviseVo
	 * @param omcBillAdjustFee
	 * @param oldmanSex
	 */
	public static void reviseBillDown(HttpServletResponse response,
									  String titleName, String sheetName,
									  OmcOldManBill omcOldManBill,
									  ReviseVo reviseVo,
									  OmcBillAdjustFee omcBillAdjustFee,
									  Integer oldmanSex) {

		OutputStream os = null;
		WritableWorkbook workbook = null;

		try {

			os = response.getOutputStream();
			workbook = Workbook.createWorkbook(os);

			WritableSheet sheet = workbook.createSheet(sheetName, 0);

			//创建画笔
			//第一种画笔
			WritableFont wft = new WritableFont(WritableFont.ARIAL, 20, WritableFont.BOLD, false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK);
			WritableCellFormat wcfmt = new WritableCellFormat(wft);
			wcfmt.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN);
			//设置水平居中
			wcfmt.setAlignment(Alignment.CENTRE);
			//设置垂直居中
			wcfmt.setVerticalAlignment(VerticalAlignment.CENTRE);
			wcfmt.setWrap(true);

			//第二种画笔
			WritableFont wft1 = new WritableFont(WritableFont.ARIAL, 12, WritableFont.NO_BOLD, false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK);
			WritableCellFormat wcfmt1 = new WritableCellFormat(wft1);
			wcfmt1.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN);
			wcfmt1.setAlignment(Alignment.CENTRE);
			//设置垂直居中
			wcfmt1.setVerticalAlignment(VerticalAlignment.CENTRE);
			wcfmt1.setWrap(true);

			//第三种画笔
			WritableFont wft2 = new WritableFont(WritableFont.ARIAL, 12, WritableFont.BOLD, false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK);
			WritableCellFormat wcfmt2 = new WritableCellFormat(wft2);
			wcfmt2.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN);
			//设置水平居中
			wcfmt2.setAlignment(Alignment.CENTRE);
			//设置垂直居中
			wcfmt2.setVerticalAlignment(VerticalAlignment.CENTRE);
			wcfmt2.setWrap(true);

			//第四种画笔
			WritableFont wft3 = new WritableFont(WritableFont.ARIAL, 12, WritableFont.BOLD, false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK);
			WritableCellFormat wcfmt3 = new WritableCellFormat(wft3);
			wcfmt3.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN);
			//设置水平左对齐
			wcfmt3.setAlignment(Alignment.LEFT);
			//设置垂直居中
			wcfmt3.setVerticalAlignment(VerticalAlignment.CENTRE);
			wcfmt3.setWrap(true);

			// 第一行
			sheet.mergeCells(0, 0, 5, 0);
			sheet.addCell(new Label(0, 0, titleName, wcfmt));
			sheet.setRowView(0, 1000);
			//第二行
			sheet.mergeCells(0,1,5,1);
			sheet.addCell(new Label(0, 1, "基本信息", wcfmt3));
			sheet.setRowView(1, 600);
			//第三、四行
			String billNumber ="";

			if (PublicUtil.isNotEmpty(omcOldManBill.getBillNumber())){
				 billNumber = omcOldManBill.getBillNumber();
			}
			String oldmanName = reviseVo.getOldmanName();
			String idCard = reviseVo.getIdCard();
			String sexStr = "";
			switch (oldmanSex){
				case 0:sexStr="男";break;
				case 1:sexStr="女";break;
				default:sexStr="";break;
			}
			String bedNo = omcOldManBill.getBedNo();
			sheet.mergeCells(0,2,5,3);
			String third = String.format("缴费单号: %s       老人姓名: %s       性别: %s \n身份证号: %s       床位号: %s",
					                     billNumber,oldmanName,sexStr,idCard,bedNo);
			sheet.addCell(new Label(0,2,third,wcfmt1 ));
			sheet.setRowView(2, 1000);
			//第五行-间隔行
			sheet.mergeCells(0,4,5,4);
			sheet.setRowView(4, 500);
			//第六行
			sheet.mergeCells(0,5,5,5);
			sheet.addCell(new Label(0, 5, "入院时间", wcfmt3));
			sheet.setRowView(5, 600);
			//第七行
			String inDate = omcOldManBill.getInDate();
			sheet.mergeCells(0,6,5,6);
			String seven =String.format("入院时间: %s",inDate);
			sheet.addCell(new Label(0,6,seven,wcfmt1 ));
			sheet.setRowView(6, 500);
			//第八行-间隔行
			sheet.mergeCells(0,7,5,7);
			sheet.setRowView(7, 500);
			//第九行
			sheet.mergeCells(0,8,5,8);
			sheet.addCell(new Label(0, 8, "调整前缴费单", wcfmt2));
			sheet.setRowView(8, 600);
			//第十行-调整前缴费单表头
			sheet.addCell(new Label(0,9,"费用类别",wcfmt2));
			sheet.addCell(new Label(1,9,"缴费项目",wcfmt2));
			sheet.addCell(new Label(2,9,"项目费用",wcfmt2));
			sheet.addCell(new Label(3,9,"人员类别减免费用",wcfmt2));
			sheet.addCell(new Label(4,9,"人工减免费用",wcfmt2));
			sheet.addCell(new Label(5,9,"实际费用",wcfmt2));
			sheet.setRowView( 9, 600);
			//第十一行-开始写入数据
			int row = 10;
			List<ReviseItemVo> reviseItemVoList = reviseVo.getReviseItemVoList();
			for (ReviseItemVo vo : reviseItemVoList) {
				if (vo.getAdjustOrder() == 1) {
					sheet.addCell(new Label(0, row, vo.getItemType(), wcfmt1));
					sheet.addCell(new Label(1, row, vo.getItemName(), wcfmt1));
					sheet.addCell(new Label(2, row, vo.getItemFee().toString(), wcfmt1));
					sheet.addCell(new Label(3, row, vo.getUserTypeRateRefief().toString(), wcfmt1));
					sheet.addCell(new Label(4, row, vo.getUserRateRefief().toString(), wcfmt1));
					sheet.addCell(new Label(5, row, vo.getActualFee().toString(), wcfmt1));
					sheet.setRowView(row, 600);
					row++;
				}
			}
			//第row+1行-间隔行
			sheet.mergeCells(0,row,5,row);
			sheet.setRowView(row, 500);
			//第row+2行
			sheet.mergeCells(0,row+1,5,row+1);
			sheet.addCell(new Label(0, row+1, "调整后缴费单", wcfmt2));
			sheet.setRowView(row+1, 600);
			//第row+3行-调整后缴费单表头
			sheet.addCell(new Label(0,row+2,"费用类别",wcfmt2));
			sheet.addCell(new Label(1,row+2,"缴费项目",wcfmt2));
			sheet.addCell(new Label(2,row+2,"项目费用",wcfmt2));
			sheet.addCell(new Label(3,row+2,"人员类别减免费用",wcfmt2));
			sheet.addCell(new Label(4,row+2,"人工减免费用",wcfmt2));
			sheet.addCell(new Label(5,row+2,"实际费用",wcfmt2));
			sheet.setRowView( row+2, 600);
			//第row+4行-开始写入数据
			int row1 = row+3;
			for (ReviseItemVo vo1 : reviseItemVoList) {
				if (vo1.getAdjustOrder() == 2) {
					sheet.addCell(new Label(0, row1, vo1.getItemType(), wcfmt1));
					sheet.addCell(new Label(1, row1, vo1.getItemName(), wcfmt1));
					sheet.addCell(new Label(2, row1, vo1.getItemFee().toString(), wcfmt1));
					sheet.addCell(new Label(3, row1, vo1.getUserTypeRateRefief().toString(), wcfmt1));
					sheet.addCell(new Label(4, row1, vo1.getUserRateRefief().toString(), wcfmt1));
					sheet.addCell(new Label(5, row1, vo1.getActualFee().toString(), wcfmt1));
					sheet.setRowView(row1, 600);
					row1++;
				}
			}
			//第row1+1行-间隔行
			sheet.mergeCells(0,row1,5,row1);
			sheet.setRowView(row1, 500);
			//第row1+2行
			sheet.mergeCells(0,row1+1,5,row1+1);
			sheet.addCell(new Label(0, row1+1, "应缴合计", wcfmt2));
			sheet.setRowView(row1+1, 600);
			//第row1+3行-应缴合计表头
			sheet.addCell(new Label(0,row1+2,"应缴合计",wcfmt2));
			sheet.addCell(new Label(1,row1+2,"调整前余额",wcfmt2));
			sheet.addCell(new Label(2,row1+2,"调整后余额",wcfmt2));
			sheet.addCell(new Label(3,row1+2,"调整差额",wcfmt2));
			sheet.addCell(new Label(4,row1+2,"请假退费金额",wcfmt2));
			sheet.addCell(new Label(5,row1+2,"套餐退费金额",wcfmt2));
			//第row1+4行-写入数据
			sheet.addCell(new Label(0, row1+3,omcBillAdjustFee.getTotalFee().toString(),wcfmt1));
			sheet.addCell(new Label(1, row1+3, omcBillAdjustFee.getBeforeAdjustBalance().toString(),wcfmt1));
			sheet.addCell(new Label(2, row1+3,omcBillAdjustFee.getAfterAdjustBalance().toString(),wcfmt1));
			sheet.addCell(new Label(3, row1+3,omcBillAdjustFee.getPayableFeeBalance().toString(),wcfmt1));
			sheet.addCell(new Label(4, row1+3,omcBillAdjustFee.getLeaveBackFee().toString(),wcfmt1));
			sheet.addCell(new Label(5, row1+3,omcBillAdjustFee.getMealBackFee().toString(),wcfmt1));
			sheet.setRowView(row1+3,600);

			// 设置宽度
			sheet.setColumnView(0,20);
			sheet.setColumnView(1,20);
			sheet.setColumnView(2,20);
			sheet.setColumnView(3,20);
			sheet.setColumnView(4,20);
			sheet.setColumnView(5,20);

			// 写入Excel工作表
			workbook.write();

			//关闭Excel工作薄对象
			workbook.close();

			//关闭流
			os.flush();
			os.close();

			os = null;
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	/**
	 *
	 *   jxl导出excel
	 *   @author ZNR
	 *   @date  2020-12-22
	 *
	 * 周期账单报表导出（账单ID）
	 *
	 * @param response
	 * @param titleName
	 * @param sheetName
	 * @param omcOldManBill
	 * @param omcOldManBillDetailVo
	 */
	public static void cycleBillDown(HttpServletResponse response,
										String titleName, String sheetName,
										OmcOldManBill omcOldManBill,
										OmcOldManBillDetailVo omcOldManBillDetailVo) {
		OutputStream os = null;
		WritableWorkbook workbook = null;

		try {

			os = response.getOutputStream();
			workbook = Workbook.createWorkbook(os);

			WritableSheet sheet = workbook.createSheet(sheetName, 0);

			//创建画笔
			//第一种画笔
			WritableFont wft = new WritableFont(WritableFont.ARIAL, 20, WritableFont.BOLD, false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK);
			WritableCellFormat wcfmt = new WritableCellFormat(wft);
			wcfmt.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN);
			//设置水平居中
			wcfmt.setAlignment(Alignment.CENTRE);
			//设置垂直居中
			wcfmt.setVerticalAlignment(VerticalAlignment.CENTRE);
			wcfmt.setWrap(true);

			//第二种画笔
			WritableFont wft1 = new WritableFont(WritableFont.ARIAL, 12, WritableFont.NO_BOLD, false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK);
			WritableCellFormat wcfmt1 = new WritableCellFormat(wft1);
			wcfmt1.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN);
			wcfmt1.setAlignment(Alignment.CENTRE);
			//设置垂直居中
			wcfmt1.setVerticalAlignment(VerticalAlignment.CENTRE);
			wcfmt1.setWrap(true);

			//第三种画笔
			WritableFont wft2 = new WritableFont(WritableFont.ARIAL, 12, WritableFont.BOLD, false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK);
			WritableCellFormat wcfmt2 = new WritableCellFormat(wft2);
			wcfmt2.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN);
			//设置水平居中
			wcfmt2.setAlignment(Alignment.CENTRE);
			//设置垂直居中
			wcfmt2.setVerticalAlignment(VerticalAlignment.CENTRE);
			wcfmt2.setWrap(true);

			//第四种画笔
			WritableFont wft3 = new WritableFont(WritableFont.ARIAL, 12, WritableFont.BOLD, false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK);
			WritableCellFormat wcfmt3 = new WritableCellFormat(wft3);
			wcfmt3.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN);
			//设置水平左对齐
			wcfmt3.setAlignment(Alignment.LEFT);
			//设置垂直居中
			wcfmt3.setVerticalAlignment(VerticalAlignment.CENTRE);
			wcfmt3.setWrap(true);

			// 第一行
			sheet.mergeCells(0, 0, 5, 0);
			sheet.addCell(new Label(0, 0, titleName, wcfmt));
			sheet.setRowView(0, 1000);
			//第二行
			sheet.mergeCells(0,1,5,1);
			sheet.addCell(new Label(0, 1, "基本信息", wcfmt3));
			sheet.setRowView(1, 600);
			//第三、四行
			String billNumber = omcOldManBill.getBillNumber();
			String oldName = omcOldManBillDetailVo.getOldName();
			String idCard = omcOldManBillDetailVo.getIdCard();
			Integer sex = omcOldManBillDetailVo.getSex();
			String sexStr = "";
			switch (sex){
				case 0:sexStr="男";break;
				case 1:sexStr="女";break;
				default:sexStr="";break;
			}
			String newBedNo = omcOldManBillDetailVo.getNewBedNo();
			sheet.mergeCells(0,2,5,3);
			String third = String.format("缴费单号: %s       老人姓名: %s       性别: %s \n身份证号: %s       床位号: %s",billNumber,oldName,sexStr,idCard,newBedNo);
			sheet.addCell(new Label(0,2,third,wcfmt1 ));
			sheet.setRowView(2, 1000);
			//第五行-间隔行
			sheet.mergeCells(0,4,5,4);
			sheet.setRowView(4, 500);
			//第六行
			sheet.mergeCells(0,5,5,5);
			sheet.addCell(new Label(0, 5, "入院时间", wcfmt3));
			sheet.setRowView(5, 600);
			//第七行
			String inDate = omcOldManBill.getInDate();
			sheet.mergeCells(0,6,5,6);
			String seven =String.format("入院时间: %s",inDate);
			sheet.addCell(new Label(0,6,seven,wcfmt1 ));
			sheet.setRowView(6, 500);
			//第八行-间隔行
			sheet.mergeCells(0,7,5,7);
			sheet.setRowView(7, 500);
			//第九行
			sheet.mergeCells(0,8,5,8);
			sheet.addCell(new Label(0, 8, "本周期缴费项目列表", wcfmt2));
			sheet.setRowView(8, 600);
			//第十行-本周期缴费项目列表表头
			sheet.addCell(new Label(0,9,"费用类别",wcfmt2));
			sheet.addCell(new Label(1,9,"缴费项目",wcfmt2));
			sheet.addCell(new Label(2,9,"项目费用",wcfmt2));
			sheet.addCell(new Label(3,9,"人员类别减免费用",wcfmt2));
			sheet.addCell(new Label(4,9,"人工减免费用",wcfmt2));
			sheet.addCell(new Label(5,9,"实际费用",wcfmt2));
			sheet.setRowView( 9, 600);
			//第十一行-开始写入数据
			int row = 10;
			List<OmcBillItem> omcBillItemList = omcOldManBillDetailVo.getBillItemList();
			for (OmcBillItem item : omcBillItemList) {
				if (item.getModelCode() == 2) {
					sheet.addCell(new Label(0, row, item.getItemType(), wcfmt1));
					sheet.addCell(new Label(1, row, item.getItemName(), wcfmt1));
					sheet.addCell(new Label(2, row, item.getItemFee().toString(), wcfmt1));
					sheet.addCell(new Label(3, row, item.getUserTypeRateRefief().toString(), wcfmt1));
					sheet.addCell(new Label(4, row, item.getUserRateRefief().toString(), wcfmt1));
					sheet.addCell(new Label(5, row, item.getActualFee().toString(), wcfmt1));
					sheet.setRowView(row, 600);
					row++;
				}
			}
			//第row+1行-间隔行
			sheet.mergeCells(0,row,5,row);
			sheet.setRowView(row, 500);
			//第row+2行
			sheet.mergeCells(0,row+1,5,row+1);
			sheet.addCell(new Label(0, row+1, "本周期缴费项目列表", wcfmt2));
			sheet.setRowView(row+1, 600);
			//第row+3行-本周期缴费项目列表表头
			sheet.addCell(new Label(0,row+2,"缴费单生成前余额",wcfmt2));
			sheet.addCell(new Label(1,row+2,"缴费单生成后余额",wcfmt2));
			sheet.addCell(new Label(2,row+2,"本周期缴费金额",wcfmt2));
			sheet.addCell(new Label(3,row+2,"上周期退费金额",wcfmt2));
			sheet.addCell(new Label(4,row+2,"上周期欠缴金额",wcfmt2));
			sheet.addCell(new Label(5,row+2,"实缴金额",wcfmt2));
			sheet.setRowView( row+2, 600);
			//第row+4行-开始写入数据
			OmcBillPeriodFee fee = omcOldManBillDetailVo.getBillPeriodFee();
			sheet.addCell(new Label(0,row+3,fee.getBeforeProduceBalance().toString(),wcfmt1));
			sheet.addCell(new Label(1,row+3,fee.getAfterProduceBalance().toString(),wcfmt1));
			sheet.addCell(new Label(2,row+3,fee.getTheWeekPayFee().toString(),wcfmt1));
			sheet.addCell(new Label(3,row+3,fee.getLastWeekBackFee().toString(),wcfmt1));
			sheet.addCell(new Label(4,row+3,fee.getLastWeekOweFee().toString(),wcfmt1));
			sheet.addCell(new Label(5,row+3,fee.getTotalFee().toString(),wcfmt1));

			// 设置宽度
			sheet.setColumnView(0,20);
			sheet.setColumnView(1,20);
			sheet.setColumnView(2,20);
			sheet.setColumnView(3,20);
			sheet.setColumnView(4,20);
			sheet.setColumnView(5,20);

			// 写入Excel工作表
			workbook.write();

			//关闭Excel工作薄对象
			workbook.close();

			//关闭流
			os.flush();
			os.close();

			os = null;
		}catch (Exception e) {
			e.printStackTrace();
		}
	}




}
